Standardizes import gathering code (#13137)

* Uses the same util to add all imports

* Removes unneeded class variable definition

* Samples regenerated for Groovy

* Fixes imports in Lua so object import does not show up

* Fixes nim imports

* Fixes proto generation

* Removes accidental new protobuf sample

* Improves proto allOf test

* Controls import addition with parametersAndResponsesImportFromV3SpecLocations

* More import protection in fromFormProperty

* More test fixes

* Samples regenerated

* Do not import composed schemas if those features are not supported

* Samples regenerated

* Adds new param importContainerType

* Fixes tests

* Samples regenerated

* Turns off importContainerType in JavaMicronautAbstractCodegen and regens samples

* Reverts most import changes, puts original imports behind a constant check

* Samples regenerated

* Updates model imports, samples regenerated

* Removes typeMapping and instantiationMap types from getImports

* Reverts template and regens samples

* Revers generator java files

* Stops setting complexType on codegenParameter

* Adds missing import back in

* Reverts languageSpecificPrimitives changes

* Samples regenerated

* Regnerates samples

* Reverts proto files

* Removes hoistParameterArrayItemBaseTypeHigher

* Samples regen

* Reverts parameter property

* Turns off importContainerType in getContent

* Samples regenerated

* Uncomments java test

* Adds imports for codegenParameter.schema

* Changes property name to importFromV3SpecLocations

* Changes property name to addSchemaImportsFromV3SpecLocations

* Removes unused java codes

* Fixes javadoc

* Removes extra docs file
This commit is contained in:
Justin Black 2022-08-19 16:37:02 -07:00 committed by GitHub
parent 719f429107
commit 52eb13f662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 1726 additions and 97 deletions

View File

@ -151,6 +151,7 @@ public class DefaultCodegen implements CodegenConfig {
protected String outputFolder = ""; protected String outputFolder = "";
protected Set<String> defaultIncludes; protected Set<String> defaultIncludes;
protected Map<String, String> typeMapping; protected Map<String, String> typeMapping;
// instantiationTypes map from container types only: set, map, and array to the in language-type
protected Map<String, String> instantiationTypes; protected Map<String, String> instantiationTypes;
protected Set<String> reservedWords; protected Set<String> reservedWords;
protected Set<String> languageSpecificPrimitives = new HashSet<>(); protected Set<String> languageSpecificPrimitives = new HashSet<>();
@ -281,6 +282,16 @@ public class DefaultCodegen implements CodegenConfig {
protected boolean loadDeepObjectIntoItems = true; protected boolean loadDeepObjectIntoItems = true;
// if true then baseTypes will be imported
protected boolean importBaseType = true;
// if true then container types will be imported
protected boolean importContainerType = true;
// if True codegenParameter and codegenResponse imports will come
// from deeper schema defined locations
protected boolean addSchemaImportsFromV3SpecLocations = false;
@Override @Override
public List<CliOption> cliOptions() { public List<CliOption> cliOptions() {
return cliOptions; return cliOptions;
@ -288,6 +299,7 @@ public class DefaultCodegen implements CodegenConfig {
@Override @Override
public void processOpts() { public void processOpts() {
if (additionalProperties.containsKey(CodegenConstants.TEMPLATE_DIR)) { if (additionalProperties.containsKey(CodegenConstants.TEMPLATE_DIR)) {
this.setTemplateDir((String) additionalProperties.get(CodegenConstants.TEMPLATE_DIR)); this.setTemplateDir((String) additionalProperties.get(CodegenConstants.TEMPLATE_DIR));
} }
@ -2949,6 +2961,9 @@ public class DefaultCodegen implements CodegenConfig {
} }
} }
if (addSchemaImportsFromV3SpecLocations) {
addImports(m.imports, m.getImports(importContainerType, importBaseType, generatorMetadata.getFeatureSet()));
}
return m; return m;
} }
@ -4173,6 +4188,7 @@ public class DefaultCodegen implements CodegenConfig {
String mediaTypeSchemaSuffix = String.format(Locale.ROOT, "%sResponseBody", r.code); String mediaTypeSchemaSuffix = String.format(Locale.ROOT, "%sResponseBody", r.code);
r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix)); r.setContent(getContent(response.getContent(), imports, mediaTypeSchemaSuffix));
if (!addSchemaImportsFromV3SpecLocations) {
if (r.baseType != null && if (r.baseType != null &&
!defaultIncludes.contains(r.baseType) && !defaultIncludes.contains(r.baseType) &&
!languageSpecificPrimitives.contains(r.baseType)) { !languageSpecificPrimitives.contains(r.baseType)) {
@ -4182,6 +4198,7 @@ public class DefaultCodegen implements CodegenConfig {
op.uniqueItems = true; op.uniqueItems = true;
imports.add(typeMapping.get(r.containerType)); imports.add(typeMapping.get(r.containerType));
} }
}
op.responses.add(r); op.responses.add(r);
if (Boolean.TRUE.equals(r.isBinary) && Boolean.TRUE.equals(r.is2xx) && Boolean.FALSE.equals(op.isResponseBinary)) { if (Boolean.TRUE.equals(r.isBinary) && Boolean.TRUE.equals(r.is2xx) && Boolean.FALSE.equals(op.isResponseBinary)) {
@ -4669,12 +4686,14 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.isContainer = true; codegenParameter.isContainer = true;
codegenParameter.isMap = true; codegenParameter.isMap = true;
if (!addSchemaImportsFromV3SpecLocations) {
// recursively add import // recursively add import
while (codegenProperty != null) { while (codegenProperty != null) {
imports.add(codegenProperty.baseType); imports.add(codegenProperty.baseType);
codegenProperty = codegenProperty.items; codegenProperty = codegenProperty.items;
} }
} }
}
protected void updateParameterForString(CodegenParameter codegenParameter, Schema parameterSchema) { protected void updateParameterForString(CodegenParameter codegenParameter, Schema parameterSchema) {
if (ModelUtils.isEmailSchema(parameterSchema)) { if (ModelUtils.isEmailSchema(parameterSchema)) {
@ -4757,6 +4776,9 @@ public class DefaultCodegen implements CodegenConfig {
prop = fromProperty(parameter.getName(), parameterSchema, false); prop = fromProperty(parameter.getName(), parameterSchema, false);
} }
codegenParameter.setSchema(prop); codegenParameter.setSchema(prop);
if (addSchemaImportsFromV3SpecLocations) {
addImports(imports, prop.getImports(importContainerType, importBaseType, generatorMetadata.getFeatureSet()));
}
} else if (parameter.getContent() != null) { } else if (parameter.getContent() != null) {
Content content = parameter.getContent(); Content content = parameter.getContent();
if (content.size() > 1) { if (content.size() > 1) {
@ -4790,7 +4812,7 @@ public class DefaultCodegen implements CodegenConfig {
return codegenParameter; return codegenParameter;
} }
// TODO need to reivew replacing empty map with schemaMapping instead // TODO need to review replacing empty map with schemaMapping instead
parameterSchema = unaliasSchema(parameterSchema); parameterSchema = unaliasSchema(parameterSchema);
if (parameterSchema == null) { if (parameterSchema == null) {
LOGGER.warn("warning! Schema not found for parameter \" {} \"", parameter.getName()); LOGGER.warn("warning! Schema not found for parameter \" {} \"", parameter.getName());
@ -4882,12 +4904,13 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.mostInnerItems = itemsProperty.mostInnerItems; codegenParameter.mostInnerItems = itemsProperty.mostInnerItems;
codegenParameter.baseType = itemsProperty.dataType; codegenParameter.baseType = itemsProperty.dataType;
codegenParameter.isContainer = true; codegenParameter.isContainer = true;
if (!addSchemaImportsFromV3SpecLocations) {
// recursively add import // recursively add import
while (itemsProperty != null) { while (itemsProperty != null) {
imports.add(itemsProperty.baseType); imports.add(itemsProperty.baseType);
itemsProperty = itemsProperty.items; itemsProperty = itemsProperty.items;
} }
}
} else { } else {
// referenced schemas // referenced schemas
; ;
@ -4906,9 +4929,11 @@ public class DefaultCodegen implements CodegenConfig {
} else { } else {
codegenParameter.dataType = codegenProperty.dataType; codegenParameter.dataType = codegenProperty.dataType;
} }
if (!addSchemaImportsFromV3SpecLocations) {
if (ModelUtils.isSet(parameterSchema)) { if (ModelUtils.isSet(parameterSchema)) {
imports.add(codegenProperty.baseType); imports.add(codegenProperty.baseType);
} }
}
codegenParameter.dataFormat = codegenProperty.dataFormat; codegenParameter.dataFormat = codegenProperty.dataFormat;
if (parameter.getRequired() != null) { if (parameter.getRequired() != null) {
codegenParameter.required = parameter.getRequired().booleanValue(); codegenParameter.required = parameter.getRequired().booleanValue();
@ -4937,11 +4962,12 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.isCollectionFormatMulti = true; codegenParameter.isCollectionFormatMulti = true;
} }
codegenParameter.paramName = toParamName(parameter.getName()); codegenParameter.paramName = toParamName(parameter.getName());
if (!addSchemaImportsFromV3SpecLocations) {
// import // import
if (codegenProperty.complexType != null) { if (codegenProperty.complexType != null) {
imports.add(codegenProperty.complexType); imports.add(codegenProperty.complexType);
} }
}
codegenParameter.pattern = toRegularExpression(parameterSchema.getPattern()); codegenParameter.pattern = toRegularExpression(parameterSchema.getPattern());
if (codegenParameter.isQueryParam && codegenParameter.isDeepObject && loadDeepObjectIntoItems) { if (codegenParameter.isQueryParam && codegenParameter.isDeepObject && loadDeepObjectIntoItems) {
@ -5311,6 +5337,7 @@ public class DefaultCodegen implements CodegenConfig {
final CodegenProperty property = fromProperty(name, schema, false); final CodegenProperty property = fromProperty(name, schema, false);
addImport(model, property.complexType); addImport(model, property.complexType);
model.parent = toInstantiationType(schema); model.parent = toInstantiationType(schema);
if (!addSchemaImportsFromV3SpecLocations) {
final String containerType = property.containerType; final String containerType = property.containerType;
final String instantiationType = instantiationTypes.get(containerType); final String instantiationType = instantiationTypes.get(containerType);
if (instantiationType != null) { if (instantiationType != null) {
@ -5322,6 +5349,7 @@ public class DefaultCodegen implements CodegenConfig {
addImport(model, mappedType); addImport(model, mappedType);
} }
} }
}
/** /**
* Generate the next name for the given name, i.e. append "2" to the base name if not ending with a number, * Generate the next name for the given name, i.e. append "2" to the base name if not ending with a number,
@ -5350,7 +5378,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
protected void addImports(Set<String> importsToBeAddedTo, IJsonSchemaValidationProperties type) { protected void addImports(Set<String> importsToBeAddedTo, IJsonSchemaValidationProperties type) {
addImports(importsToBeAddedTo, type.getImports(true)); addImports(importsToBeAddedTo, type.getImports(importContainerType, importBaseType, generatorMetadata.getFeatureSet()));
} }
protected void addImports(Set<String> importsToBeAddedTo, Set<String> importsToAdd) { protected void addImports(Set<String> importsToBeAddedTo, Set<String> importsToAdd) {
@ -5519,8 +5547,9 @@ public class DefaultCodegen implements CodegenConfig {
if (!Boolean.TRUE.equals(cp.isReadOnly)) { if (!Boolean.TRUE.equals(cp.isReadOnly)) {
cm.hasOnlyReadOnly = false; cm.hasOnlyReadOnly = false;
} }
if (!addSchemaImportsFromV3SpecLocations) {
addImportsForPropertyType(cm, cp); addImportsForPropertyType(cm, cp);
}
// if required, add to the list "requiredVars" // if required, add to the list "requiredVars"
if (Boolean.FALSE.equals(cp.required)) { if (Boolean.FALSE.equals(cp.required)) {
@ -6658,11 +6687,13 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.collectionFormat = StringUtils.isEmpty(collectionFormat) ? "csv" : collectionFormat; codegenParameter.collectionFormat = StringUtils.isEmpty(collectionFormat) ? "csv" : collectionFormat;
codegenParameter.isCollectionFormatMulti = "multi".equals(collectionFormat); codegenParameter.isCollectionFormatMulti = "multi".equals(collectionFormat);
if (!addSchemaImportsFromV3SpecLocations) {
// recursively add import // recursively add import
while (arrayInnerProperty != null) { while (arrayInnerProperty != null) {
imports.add(arrayInnerProperty.baseType); imports.add(arrayInnerProperty.baseType);
arrayInnerProperty = arrayInnerProperty.items; arrayInnerProperty = arrayInnerProperty.items;
} }
}
} else { } else {
// referenced schemas // referenced schemas
; ;
@ -6689,11 +6720,12 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.enumName = codegenProperty.enumName; codegenParameter.enumName = codegenProperty.enumName;
} }
if (!addSchemaImportsFromV3SpecLocations) {
// import // import
if (codegenProperty.complexType != null) { if (codegenProperty.complexType != null) {
imports.add(codegenProperty.complexType); imports.add(codegenProperty.complexType);
} }
}
setParameterExampleValue(codegenParameter); setParameterExampleValue(codegenParameter);
// set nullable // set nullable
setParameterNullable(codegenParameter, codegenProperty); setParameterNullable(codegenParameter, codegenProperty);
@ -6722,13 +6754,18 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.dataType = getTypeDeclaration(codegenModel.classname); codegenParameter.dataType = getTypeDeclaration(codegenModel.classname);
codegenParameter.description = codegenModel.description; codegenParameter.description = codegenModel.description;
codegenParameter.isNullable = codegenModel.isNullable; codegenParameter.isNullable = codegenModel.isNullable;
if (!addSchemaImportsFromV3SpecLocations) {
imports.add(codegenParameter.baseType); imports.add(codegenParameter.baseType);
}
} else { } else {
CodegenProperty codegenProperty = fromProperty("property", schema, false); CodegenProperty codegenProperty = fromProperty("property", schema, false);
if (codegenProperty != null && codegenProperty.getComplexType() != null && codegenProperty.getComplexType().contains(" | ")) { if (codegenProperty != null && codegenProperty.getComplexType() != null && codegenProperty.getComplexType().contains(" | ")) {
if (!addSchemaImportsFromV3SpecLocations) {
// TODO move this splitting logic to the generator that needs it only
List<String> parts = Arrays.asList(codegenProperty.getComplexType().split(" \\| ")); List<String> parts = Arrays.asList(codegenProperty.getComplexType().split(" \\| "));
imports.addAll(parts); imports.addAll(parts);
}
String codegenModelName = codegenProperty.getComplexType(); String codegenModelName = codegenProperty.getComplexType();
codegenParameter.baseName = codegenModelName; codegenParameter.baseName = codegenModelName;
codegenParameter.paramName = toParamName(codegenParameter.baseName); codegenParameter.paramName = toParamName(codegenParameter.baseName);
@ -6766,6 +6803,7 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.baseType = codegenModelName; codegenParameter.baseType = codegenModelName;
codegenParameter.dataType = getTypeDeclaration(codegenModelName); codegenParameter.dataType = getTypeDeclaration(codegenModelName);
codegenParameter.description = codegenModelDescription; codegenParameter.description = codegenModelDescription;
if (!addSchemaImportsFromV3SpecLocations) {
imports.add(codegenParameter.baseType); imports.add(codegenParameter.baseType);
if (codegenProperty.complexType != null) { if (codegenProperty.complexType != null) {
@ -6773,6 +6811,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
} }
} }
}
// set nullable // set nullable
setParameterNullable(codegenParameter, codegenProperty); setParameterNullable(codegenParameter, codegenProperty);
@ -6791,8 +6830,8 @@ public class DefaultCodegen implements CodegenConfig {
} }
CodegenProperty codegenProperty = fromProperty("property", schema, false); CodegenProperty codegenProperty = fromProperty("property", schema, false);
if (!addSchemaImportsFromV3SpecLocations) {
imports.add(codegenProperty.baseType); imports.add(codegenProperty.baseType);
CodegenProperty innerCp = codegenProperty; CodegenProperty innerCp = codegenProperty;
while (innerCp != null) { while (innerCp != null) {
if (innerCp.complexType != null) { if (innerCp.complexType != null) {
@ -6800,6 +6839,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
innerCp = innerCp.items; innerCp = innerCp.items;
} }
}
if (StringUtils.isEmpty(bodyParameterName)) { if (StringUtils.isEmpty(bodyParameterName)) {
codegenParameter.baseName = "request_body"; codegenParameter.baseName = "request_body";
@ -6836,10 +6876,11 @@ public class DefaultCodegen implements CodegenConfig {
codegenParameter.pattern = codegenProperty.pattern; codegenParameter.pattern = codegenProperty.pattern;
codegenParameter.isNullable = codegenProperty.isNullable; codegenParameter.isNullable = codegenProperty.isNullable;
if (!addSchemaImportsFromV3SpecLocations) {
if (codegenProperty.complexType != null) { if (codegenProperty.complexType != null) {
imports.add(codegenProperty.complexType); imports.add(codegenProperty.complexType);
} }
}
} }
// set nullable // set nullable
setParameterNullable(codegenParameter, codegenProperty); setParameterNullable(codegenParameter, codegenProperty);
@ -6885,15 +6926,19 @@ public class DefaultCodegen implements CodegenConfig {
final ArraySchema arraySchema = (ArraySchema) schema; final ArraySchema arraySchema = (ArraySchema) schema;
Schema inner = getSchemaItems(arraySchema); Schema inner = getSchemaItems(arraySchema);
CodegenProperty codegenProperty = fromProperty("property", arraySchema, false); CodegenProperty codegenProperty = fromProperty("property", arraySchema, false);
if (!addSchemaImportsFromV3SpecLocations) {
imports.add(codegenProperty.baseType); imports.add(codegenProperty.baseType);
}
CodegenProperty innerCp = codegenProperty; CodegenProperty innerCp = codegenProperty;
CodegenProperty mostInnerItem = innerCp; CodegenProperty mostInnerItem = innerCp;
// loop through multidimensional array to add proper import // loop through multidimensional array to add proper import
// also find the most inner item // also find the most inner item
while (innerCp != null) { while (innerCp != null) {
if (!addSchemaImportsFromV3SpecLocations) {
if (innerCp.complexType != null) { if (innerCp.complexType != null) {
imports.add(innerCp.complexType); imports.add(innerCp.complexType);
} }
}
mostInnerItem = innerCp; mostInnerItem = innerCp;
innerCp = innerCp.items; innerCp = innerCp.items;
} }
@ -6918,12 +6963,14 @@ public class DefaultCodegen implements CodegenConfig {
// set nullable // set nullable
setParameterNullable(codegenParameter, codegenProperty); setParameterNullable(codegenParameter, codegenProperty);
if (!addSchemaImportsFromV3SpecLocations) {
while (codegenProperty != null) { while (codegenProperty != null) {
imports.add(codegenProperty.baseType); imports.add(codegenProperty.baseType);
codegenProperty = codegenProperty.items; codegenProperty = codegenProperty.items;
} }
} }
} }
}
protected void updateRequestBodyForString(CodegenParameter codegenParameter, Schema schema, Set<String> imports, String bodyParameterName) { protected void updateRequestBodyForString(CodegenParameter codegenParameter, Schema schema, Set<String> imports, String bodyParameterName) {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports); updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
@ -7036,7 +7083,11 @@ public class DefaultCodegen implements CodegenConfig {
CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap, schemaTestCases); CodegenMediaType codegenMt = new CodegenMediaType(schemaProp, ceMap, schemaTestCases);
cmtContent.put(contentType, codegenMt); cmtContent.put(contentType, codegenMt);
if (schemaProp != null) { if (schemaProp != null) {
addImports(imports, schemaProp.getImports(false)); if (addSchemaImportsFromV3SpecLocations) {
addImports(imports, schemaProp.getImports(importContainerType, importBaseType, generatorMetadata.getFeatureSet()));
} else {
addImports(imports, schemaProp.getImports(false, importBaseType, generatorMetadata.getFeatureSet()));
}
} }
} }
return cmtContent; return cmtContent;
@ -7127,6 +7178,7 @@ public class DefaultCodegen implements CodegenConfig {
updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports); updateRequestBodyForPrimitiveType(codegenParameter, schema, bodyParameterName, imports);
} }
addJsonSchemaForBodyRequestInCaseItsNotPresent(codegenParameter, body); addJsonSchemaForBodyRequestInCaseItsNotPresent(codegenParameter, body);
// set the parameter's example value // set the parameter's example value

View File

@ -1,5 +1,6 @@
package org.openapitools.codegen; package org.openapitools.codegen;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -8,6 +9,8 @@ import java.util.Set;
import java.util.stream.Stream; import java.util.stream.Stream;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.meta.FeatureSet;
import org.openapitools.codegen.meta.features.SchemaSupportFeature;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
public interface IJsonSchemaValidationProperties { public interface IJsonSchemaValidationProperties {
@ -261,32 +264,79 @@ public interface IJsonSchemaValidationProperties {
/** /**
* Recursively collect all necessary imports to include so that the type may be resolved. * Recursively collect all necessary imports to include so that the type may be resolved.
* *
* @param includeContainerTypes whether or not to include the container types in the returned imports. * @param importContainerType whether or not to include the container types in the returned imports.
* @param importBaseType whether or not to include the base types in the returned imports.
* @param featureSet the generator feature set, used to determine if composed schemas should be added
* @return all of the imports * @return all of the imports
*/ */
default Set<String> getImports(boolean includeContainerTypes) { default Set<String> getImports(boolean importContainerType, boolean importBaseType, FeatureSet featureSet) {
Set<String> imports = new HashSet<>(); Set<String> imports = new HashSet<>();
if (this.getComposedSchemas() != null) { if (this.getComposedSchemas() != null) {
CodegenComposedSchemas composed = (CodegenComposedSchemas) this.getComposedSchemas(); CodegenComposedSchemas composed = this.getComposedSchemas();
List<CodegenProperty> allOfs = composed.getAllOf() == null ? Collections.emptyList() : composed.getAllOf(); List<CodegenProperty> allOfs = Collections.emptyList();
List<CodegenProperty> oneOfs = composed.getOneOf() == null ? Collections.emptyList() : composed.getOneOf(); List<CodegenProperty> oneOfs = Collections.emptyList();
Stream<CodegenProperty> innerTypes = Stream.concat(allOfs.stream(), oneOfs.stream()); List<CodegenProperty> anyOfs = Collections.emptyList();
innerTypes.flatMap(cp -> cp.getImports(includeContainerTypes).stream()).forEach(s -> imports.add(s)); List<CodegenProperty> nots = Collections.emptyList();
} else if (includeContainerTypes || !(this.getIsArray() || this.getIsMap())) { if (composed.getAllOf() != null && featureSet.getSchemaSupportFeatures().contains(SchemaSupportFeature.allOf)) {
// this is our base case, add imports for referenced schemas allOfs = composed.getAllOf();
// this can't be broken out as a separate if block because Typescript only generates union types as A | B
// and would need to handle this differently
imports.add(this.getComplexType());
imports.add(this.getBaseType());
} }
if (this.getItems() !=null && this.getIsArray()) { if (composed.getOneOf() != null && featureSet.getSchemaSupportFeatures().contains(SchemaSupportFeature.oneOf)) {
imports.addAll(this.getItems().getImports(includeContainerTypes)); oneOfs = composed.getOneOf();
} }
if (composed.getAnyOf() != null && featureSet.getSchemaSupportFeatures().contains(SchemaSupportFeature.anyOf)) {
anyOfs = composed.getAnyOf();
}
if (composed.getNot() != null && featureSet.getSchemaSupportFeatures().contains(SchemaSupportFeature.not)) {
nots = Arrays.asList(composed.getNot());
}
Stream<CodegenProperty> innerTypes = Stream.of(
allOfs.stream(), anyOfs.stream(), oneOfs.stream(), nots.stream())
.flatMap(i -> i);
innerTypes.flatMap(cp -> cp.getImports(importContainerType, importBaseType, featureSet).stream()).forEach(s -> imports.add(s));
}
// items can exist for AnyType and type array
if (this.getItems() != null && this.getIsArray()) {
imports.addAll(this.getItems().getImports(importContainerType, importBaseType, featureSet));
}
// additionalProperties can exist for AnyType and type object
if (this.getAdditionalProperties() != null) { if (this.getAdditionalProperties() != null) {
imports.addAll(this.getAdditionalProperties().getImports(includeContainerTypes)); imports.addAll(this.getAdditionalProperties().getImports(importContainerType, importBaseType, featureSet));
} }
// vars can exist for AnyType and type object
if (this.getVars() != null && !this.getVars().isEmpty()) { if (this.getVars() != null && !this.getVars().isEmpty()) {
this.getVars().stream().flatMap(v -> v.getImports(includeContainerTypes).stream()).forEach(s -> imports.add(s)); this.getVars().stream().flatMap(v -> v.getImports(importContainerType, importBaseType, featureSet).stream()).forEach(s -> imports.add(s));
}
if (this.getIsArray() || this.getIsMap()) {
if (importContainerType) {
/*
use-case for this complexType block:
DefaultCodegenTest.objectQueryParamIdentifyAsObject
DefaultCodegenTest.mapParamImportInnerObject
*/
String complexType = this.getComplexType();
if (complexType != null) {
imports.add(complexType);
}
/*
use-case:
Adding List/Map etc, Java uses this
*/
String baseType = this.getBaseType();
if (importBaseType && baseType != null) {
imports.add(baseType);
}
}
} else {
// referenced or inline schemas
String complexType = this.getComplexType();
if (complexType != null) {
imports.add(complexType);
}
String baseType = this.getBaseType();
if (importBaseType && baseType != null) {
imports.add(baseType);
}
return imports;
} }
return imports; return imports;
} }

View File

@ -105,10 +105,11 @@ public class PythonExperimentalClientCodegen extends AbstractPythonCodegen {
// for apis.tags tag api definition // for apis.tags tag api definition
private Map<String, String> tagEnumToApiClassname = new LinkedHashMap<>(); private Map<String, String> tagEnumToApiClassname = new LinkedHashMap<>();
public PythonExperimentalClientCodegen() { public PythonExperimentalClientCodegen() {
super(); super();
loadDeepObjectIntoItems = false; loadDeepObjectIntoItems = false;
importBaseType = false;
addSchemaImportsFromV3SpecLocations = true;
modifyFeatureSet(features -> features modifyFeatureSet(features -> features
.includeSchemaSupportFeatures( .includeSchemaSupportFeatures(
@ -321,10 +322,11 @@ public class PythonExperimentalClientCodegen extends AbstractPythonCodegen {
} }
if (generateSourceCodeOnly) { if (generateSourceCodeOnly) {
// tests in <package>/test // tests in test
testFolder = packagePath() + File.separatorChar + testFolder; testFolder = packagePath() + File.separatorChar + testFolder;
// api/model docs in <package>/docs // api docs in <package>/docs/apis/tags/
apiDocPath = packagePath() + File.separatorChar + apiDocPath; apiDocPath = packagePath() + File.separatorChar + apiDocPath;
// model docs in <package>/docs/models/
modelDocPath = packagePath() + File.separatorChar + modelDocPath; modelDocPath = packagePath() + File.separatorChar + modelDocPath;
} }
// make api and model doc path available in templates // make api and model doc path available in templates
@ -866,7 +868,6 @@ public class PythonExperimentalClientCodegen extends AbstractPythonCodegen {
OperationMap val = objs.getOperations(); OperationMap val = objs.getOperations();
List<CodegenOperation> operations = val.getOperation(); List<CodegenOperation> operations = val.getOperation();
List<Map<String, String>> imports = objs.getImports();
for (CodegenOperation operation : operations) { for (CodegenOperation operation : operations) {
if (operation.imports.size() == 0) { if (operation.imports.size() == 0) {
continue; continue;
@ -901,12 +902,7 @@ public class PythonExperimentalClientCodegen extends AbstractPythonCodegen {
boolean anyModelContainsTestCases = false; boolean anyModelContainsTestCases = false;
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI); Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
for (String schemaName : allDefinitions.keySet()) { for (String schemaName : allDefinitions.keySet()) {
Schema refSchema = new Schema().$ref("#/components/schemas/" + schemaName);
Schema unaliasedSchema = unaliasSchema(refSchema);
String modelName = toModelName(schemaName); String modelName = toModelName(schemaName);
if (unaliasedSchema.get$ref() == null) {
continue;
}
ModelsMap objModel = objs.get(modelName); ModelsMap objModel = objs.get(modelName);
if (objModel == null) { if (objModel == null) {
// to avoid form parameter's models that are not generated (skipFormModel=true) // to avoid form parameter's models that are not generated (skipFormModel=true)

View File

@ -969,7 +969,7 @@ public class SpringCodegen extends AbstractJavaCodegen
parentVar.isInherited = true; parentVar.isInherited = true;
LOGGER.info("adding parent variable {}", property.name); LOGGER.info("adding parent variable {}", property.name);
codegenModel.parentVars.add(parentVar); codegenModel.parentVars.add(parentVar);
Set<String> imports = parentVar.getImports(true).stream().filter(Objects::nonNull).collect(Collectors.toSet()); Set<String> imports = parentVar.getImports(true, this.importBaseType, generatorMetadata.getFeatureSet()).stream().filter(Objects::nonNull).collect(Collectors.toSet());
for (String imp: imports) { for (String imp: imports) {
// Avoid dupes // Avoid dupes
if (!codegenModel.getImports().contains(imp)) { if (!codegenModel.getImports().contains(imp)) {

View File

@ -380,9 +380,8 @@ public class JavaJAXRSSpecServerCodegenTest extends JavaJaxrsBaseTest {
String outputPath = output.getAbsolutePath().replace('\\', '/'); String outputPath = output.getAbsolutePath().replace('\\', '/');
OpenAPI openAPI = new OpenAPIParser() OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_0/arrayParameter.yaml", null, new ParseOptions()).getOpenAPI(); .readLocation("src/test/resources/3_0/setParameter.yaml", null, new ParseOptions()).getOpenAPI();
openAPI.getComponents().getParameters().get("operationsQueryParam").setSchema(new ArraySchema().uniqueItems(true));
codegen.setOutputDir(output.getAbsolutePath()); codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true");

View File

@ -0,0 +1,22 @@
openapi: 3.0.0
paths:
/examples:
get:
tags:
- Examples
summary: Get a list of transactions
operationId: getFilteredTransactions
parameters:
- $ref: '#/components/parameters/operationsQueryParam'
components:
parameters:
operationsQueryParam:
name: operations
description: Operations list
in: query
required: false
schema:
type: array
items:
type: string
uniqueItems: true

View File

@ -2664,6 +2664,42 @@ paths:
- path.post - path.post
- contentType_json - contentType_json
- $ref - $ref
/requestBody/postRefInNotRequestBody:
post:
operationId: postRefInNotRequestBody
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RefInNot'
x-schema-test-examples:
$ref: '#/components/x-schema-test-examples/RefInNot'
required: true
responses:
'200':
description: success
tags:
- operation.requestBody
- path.post
- contentType_json
- $ref
/responseBody/postRefInNotResponseBodyForContentTypes:
post:
operationId: postRefInNotResponseBodyForContentTypes
responses:
'200':
description: success
content:
application/json:
schema:
$ref: '#/components/schemas/RefInNot'
x-schema-test-examples:
$ref: '#/components/x-schema-test-examples/RefInNot'
tags:
- response.content.contentType.schema
- path.post
- contentType_json
- $ref
/requestBody/postRequiredValidationRequestBody: /requestBody/postRequiredValidationRequestBody:
post: post:
operationId: postRequiredValidationRequestBody operationId: postRequiredValidationRequestBody
@ -3450,6 +3486,9 @@ components:
RefInAnyof: RefInAnyof:
anyOf: anyOf:
- $ref: '#/components/schemas/PropertyNamedRefThatIsNotAReference' - $ref: '#/components/schemas/PropertyNamedRefThatIsNotAReference'
RefInNot:
not:
$ref: '#/components/schemas/PropertyNamedRefThatIsNotAReference'
RequiredValidation: RequiredValidation:
properties: properties:
foo: {} foo: {}
@ -4741,6 +4780,17 @@ components:
data: data:
$ref: 2 $ref: 2
valid: false valid: false
RefInNot:
PropertyNamedRefInvalid:
description: property named $ref invalid
data:
$ref: a
valid: false
PropertyNamedRefValid:
description: property named $ref valid
data:
$ref: 2
valid: true
RequiredValidation: RequiredValidation:
PresentRequiredPropertyIsValid: PresentRequiredPropertyIsValid:
description: present required property is valid description: present required property is valid

View File

@ -101,7 +101,6 @@ class ExclusionReason:
component_ref_component_bug = 'A component refing another component does not work, issue at https://github.com/OpenAPITools/openapi-generator/issues/12730' component_ref_component_bug = 'A component refing another component does not work, issue at https://github.com/OpenAPITools/openapi-generator/issues/12730'
not_running_the_localhost_server = 'the openapo-generator is not running the localhost server needed to serve remoteRef files' not_running_the_localhost_server = 'the openapo-generator is not running the localhost server needed to serve remoteRef files'
v303_requires_that_the_default_value_is_an_allowed_type = 'v3.0.3 requires that the default value is an allowed type per the schema' v303_requires_that_the_default_value_is_an_allowed_type = 'v3.0.3 requires that the default value is an allowed type per the schema'
not_ref_import_missing = 'this test fails because of this open issue https://github.com/OpenAPITools/openapi-generator/issues/12756'
json_schema_test_draft = 'draft6' json_schema_test_draft = 'draft6'
openapi_additions = 'openapi_additions' openapi_additions = 'openapi_additions'
@ -179,7 +178,6 @@ FILEPATH_TO_EXCLUDED_CASE_AND_REASON = {
'property refs adjacent property': ExclusionReason.ref_to_adjacent_property_bug, 'property refs adjacent property': ExclusionReason.ref_to_adjacent_property_bug,
'property refs containing component schema': ExclusionReason.swagger_parser_anytype_bug, 'property refs containing component schema': ExclusionReason.swagger_parser_anytype_bug,
'component refs another component': ExclusionReason.component_ref_component_bug, 'component refs another component': ExclusionReason.component_ref_component_bug,
'ref in not': ExclusionReason.not_ref_import_missing
}, },
(json_schema_test_draft, 'refRemote.json'): { (json_schema_test_draft, 'refRemote.json'): {
'base URI change - change folder': ExclusionReason.v303_does_not_support_id, 'base URI change - change folder': ExclusionReason.v303_does_not_support_id,

View File

@ -101,6 +101,7 @@ docs/models/RefInAdditionalproperties.md
docs/models/RefInAllof.md docs/models/RefInAllof.md
docs/models/RefInAnyof.md docs/models/RefInAnyof.md
docs/models/RefInItems.md docs/models/RefInItems.md
docs/models/RefInNot.md
docs/models/RefInOneof.md docs/models/RefInOneof.md
docs/models/RefInProperty.md docs/models/RefInProperty.md
docs/models/RequiredDefaultValidation.md docs/models/RequiredDefaultValidation.md
@ -193,6 +194,7 @@ test/test_models/test_ref_in_additionalproperties.py
test/test_models/test_ref_in_allof.py test/test_models/test_ref_in_allof.py
test/test_models/test_ref_in_anyof.py test/test_models/test_ref_in_anyof.py
test/test_models/test_ref_in_items.py test/test_models/test_ref_in_items.py
test/test_models/test_ref_in_not.py
test/test_models/test_ref_in_oneof.py test/test_models/test_ref_in_oneof.py
test/test_models/test_ref_in_property.py test/test_models/test_ref_in_property.py
test/test_models/test_required_default_validation.py test/test_models/test_required_default_validation.py
@ -313,6 +315,7 @@ unit_test_api/model/ref_in_additionalproperties.py
unit_test_api/model/ref_in_allof.py unit_test_api/model/ref_in_allof.py
unit_test_api/model/ref_in_anyof.py unit_test_api/model/ref_in_anyof.py
unit_test_api/model/ref_in_items.py unit_test_api/model/ref_in_items.py
unit_test_api/model/ref_in_not.py
unit_test_api/model/ref_in_oneof.py unit_test_api/model/ref_in_oneof.py
unit_test_api/model/ref_in_property.py unit_test_api/model/ref_in_property.py
unit_test_api/model/required_default_validation.py unit_test_api/model/required_default_validation.py

View File

@ -158,6 +158,8 @@ Class | Method | HTTP request | Description
*RefApi* | [**post_ref_in_anyof_response_body_for_content_types**](docs/apis/tags/RefApi.md#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes | *RefApi* | [**post_ref_in_anyof_response_body_for_content_types**](docs/apis/tags/RefApi.md#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes |
*RefApi* | [**post_ref_in_items_request_body**](docs/apis/tags/RefApi.md#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody | *RefApi* | [**post_ref_in_items_request_body**](docs/apis/tags/RefApi.md#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody |
*RefApi* | [**post_ref_in_items_response_body_for_content_types**](docs/apis/tags/RefApi.md#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes | *RefApi* | [**post_ref_in_items_response_body_for_content_types**](docs/apis/tags/RefApi.md#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes |
*RefApi* | [**post_ref_in_not_request_body**](docs/apis/tags/RefApi.md#post_ref_in_not_request_body) | **post** /requestBody/postRefInNotRequestBody |
*RefApi* | [**post_ref_in_not_response_body_for_content_types**](docs/apis/tags/RefApi.md#post_ref_in_not_response_body_for_content_types) | **post** /responseBody/postRefInNotResponseBodyForContentTypes |
*RefApi* | [**post_ref_in_oneof_request_body**](docs/apis/tags/RefApi.md#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody | *RefApi* | [**post_ref_in_oneof_request_body**](docs/apis/tags/RefApi.md#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody |
*RefApi* | [**post_ref_in_oneof_response_body_for_content_types**](docs/apis/tags/RefApi.md#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes | *RefApi* | [**post_ref_in_oneof_response_body_for_content_types**](docs/apis/tags/RefApi.md#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes |
*RefApi* | [**post_ref_in_property_request_body**](docs/apis/tags/RefApi.md#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody | *RefApi* | [**post_ref_in_property_request_body**](docs/apis/tags/RefApi.md#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody |
@ -342,6 +344,8 @@ Class | Method | HTTP request | Description
*ContentTypeJsonApi* | [**post_ref_in_anyof_response_body_for_content_types**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes | *ContentTypeJsonApi* | [**post_ref_in_anyof_response_body_for_content_types**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes |
*ContentTypeJsonApi* | [**post_ref_in_items_request_body**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody | *ContentTypeJsonApi* | [**post_ref_in_items_request_body**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody |
*ContentTypeJsonApi* | [**post_ref_in_items_response_body_for_content_types**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes | *ContentTypeJsonApi* | [**post_ref_in_items_response_body_for_content_types**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes |
*ContentTypeJsonApi* | [**post_ref_in_not_request_body**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_not_request_body) | **post** /requestBody/postRefInNotRequestBody |
*ContentTypeJsonApi* | [**post_ref_in_not_response_body_for_content_types**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_not_response_body_for_content_types) | **post** /responseBody/postRefInNotResponseBodyForContentTypes |
*ContentTypeJsonApi* | [**post_ref_in_oneof_request_body**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody | *ContentTypeJsonApi* | [**post_ref_in_oneof_request_body**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody |
*ContentTypeJsonApi* | [**post_ref_in_oneof_response_body_for_content_types**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes | *ContentTypeJsonApi* | [**post_ref_in_oneof_response_body_for_content_types**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes |
*ContentTypeJsonApi* | [**post_ref_in_property_request_body**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody | *ContentTypeJsonApi* | [**post_ref_in_property_request_body**](docs/apis/tags/ContentTypeJsonApi.md#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody |
@ -530,6 +534,7 @@ Class | Method | HTTP request | Description
*OperationRequestBodyApi* | [**post_ref_in_allof_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_allof_request_body) | **post** /requestBody/postRefInAllofRequestBody | *OperationRequestBodyApi* | [**post_ref_in_allof_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_allof_request_body) | **post** /requestBody/postRefInAllofRequestBody |
*OperationRequestBodyApi* | [**post_ref_in_anyof_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_anyof_request_body) | **post** /requestBody/postRefInAnyofRequestBody | *OperationRequestBodyApi* | [**post_ref_in_anyof_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_anyof_request_body) | **post** /requestBody/postRefInAnyofRequestBody |
*OperationRequestBodyApi* | [**post_ref_in_items_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody | *OperationRequestBodyApi* | [**post_ref_in_items_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody |
*OperationRequestBodyApi* | [**post_ref_in_not_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_not_request_body) | **post** /requestBody/postRefInNotRequestBody |
*OperationRequestBodyApi* | [**post_ref_in_oneof_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody | *OperationRequestBodyApi* | [**post_ref_in_oneof_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody |
*OperationRequestBodyApi* | [**post_ref_in_property_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody | *OperationRequestBodyApi* | [**post_ref_in_property_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody |
*OperationRequestBodyApi* | [**post_required_default_validation_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_required_default_validation_request_body) | **post** /requestBody/postRequiredDefaultValidationRequestBody | *OperationRequestBodyApi* | [**post_required_default_validation_request_body**](docs/apis/tags/OperationRequestBodyApi.md#post_required_default_validation_request_body) | **post** /requestBody/postRequiredDefaultValidationRequestBody |
@ -688,6 +693,8 @@ Class | Method | HTTP request | Description
*PathPostApi* | [**post_ref_in_anyof_response_body_for_content_types**](docs/apis/tags/PathPostApi.md#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes | *PathPostApi* | [**post_ref_in_anyof_response_body_for_content_types**](docs/apis/tags/PathPostApi.md#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes |
*PathPostApi* | [**post_ref_in_items_request_body**](docs/apis/tags/PathPostApi.md#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody | *PathPostApi* | [**post_ref_in_items_request_body**](docs/apis/tags/PathPostApi.md#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody |
*PathPostApi* | [**post_ref_in_items_response_body_for_content_types**](docs/apis/tags/PathPostApi.md#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes | *PathPostApi* | [**post_ref_in_items_response_body_for_content_types**](docs/apis/tags/PathPostApi.md#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes |
*PathPostApi* | [**post_ref_in_not_request_body**](docs/apis/tags/PathPostApi.md#post_ref_in_not_request_body) | **post** /requestBody/postRefInNotRequestBody |
*PathPostApi* | [**post_ref_in_not_response_body_for_content_types**](docs/apis/tags/PathPostApi.md#post_ref_in_not_response_body_for_content_types) | **post** /responseBody/postRefInNotResponseBodyForContentTypes |
*PathPostApi* | [**post_ref_in_oneof_request_body**](docs/apis/tags/PathPostApi.md#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody | *PathPostApi* | [**post_ref_in_oneof_request_body**](docs/apis/tags/PathPostApi.md#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody |
*PathPostApi* | [**post_ref_in_oneof_response_body_for_content_types**](docs/apis/tags/PathPostApi.md#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes | *PathPostApi* | [**post_ref_in_oneof_response_body_for_content_types**](docs/apis/tags/PathPostApi.md#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes |
*PathPostApi* | [**post_ref_in_property_request_body**](docs/apis/tags/PathPostApi.md#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody | *PathPostApi* | [**post_ref_in_property_request_body**](docs/apis/tags/PathPostApi.md#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody |
@ -804,6 +811,7 @@ Class | Method | HTTP request | Description
*ResponseContentContentTypeSchemaApi* | [**post_ref_in_allof_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_allof_response_body_for_content_types) | **post** /responseBody/postRefInAllofResponseBodyForContentTypes | *ResponseContentContentTypeSchemaApi* | [**post_ref_in_allof_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_allof_response_body_for_content_types) | **post** /responseBody/postRefInAllofResponseBodyForContentTypes |
*ResponseContentContentTypeSchemaApi* | [**post_ref_in_anyof_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes | *ResponseContentContentTypeSchemaApi* | [**post_ref_in_anyof_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes |
*ResponseContentContentTypeSchemaApi* | [**post_ref_in_items_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes | *ResponseContentContentTypeSchemaApi* | [**post_ref_in_items_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes |
*ResponseContentContentTypeSchemaApi* | [**post_ref_in_not_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_not_response_body_for_content_types) | **post** /responseBody/postRefInNotResponseBodyForContentTypes |
*ResponseContentContentTypeSchemaApi* | [**post_ref_in_oneof_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes | *ResponseContentContentTypeSchemaApi* | [**post_ref_in_oneof_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes |
*ResponseContentContentTypeSchemaApi* | [**post_ref_in_property_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_property_response_body_for_content_types) | **post** /responseBody/postRefInPropertyResponseBodyForContentTypes | *ResponseContentContentTypeSchemaApi* | [**post_ref_in_property_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_ref_in_property_response_body_for_content_types) | **post** /responseBody/postRefInPropertyResponseBodyForContentTypes |
*ResponseContentContentTypeSchemaApi* | [**post_required_default_validation_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_required_default_validation_response_body_for_content_types) | **post** /responseBody/postRequiredDefaultValidationResponseBodyForContentTypes | *ResponseContentContentTypeSchemaApi* | [**post_required_default_validation_response_body_for_content_types**](docs/apis/tags/ResponseContentContentTypeSchemaApi.md#post_required_default_validation_response_body_for_content_types) | **post** /responseBody/postRequiredDefaultValidationResponseBodyForContentTypes |
@ -910,6 +918,7 @@ Class | Method | HTTP request | Description
- [RefInAllof](docs/models/RefInAllof.md) - [RefInAllof](docs/models/RefInAllof.md)
- [RefInAnyof](docs/models/RefInAnyof.md) - [RefInAnyof](docs/models/RefInAnyof.md)
- [RefInItems](docs/models/RefInItems.md) - [RefInItems](docs/models/RefInItems.md)
- [RefInNot](docs/models/RefInNot.md)
- [RefInOneof](docs/models/RefInOneof.md) - [RefInOneof](docs/models/RefInOneof.md)
- [RefInProperty](docs/models/RefInProperty.md) - [RefInProperty](docs/models/RefInProperty.md)
- [RequiredDefaultValidation](docs/models/RequiredDefaultValidation.md) - [RequiredDefaultValidation](docs/models/RequiredDefaultValidation.md)

View File

@ -149,6 +149,8 @@ Method | HTTP request | Description
[**post_ref_in_anyof_response_body_for_content_types**](#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes | [**post_ref_in_anyof_response_body_for_content_types**](#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes |
[**post_ref_in_items_request_body**](#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody | [**post_ref_in_items_request_body**](#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody |
[**post_ref_in_items_response_body_for_content_types**](#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes | [**post_ref_in_items_response_body_for_content_types**](#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes |
[**post_ref_in_not_request_body**](#post_ref_in_not_request_body) | **post** /requestBody/postRefInNotRequestBody |
[**post_ref_in_not_response_body_for_content_types**](#post_ref_in_not_response_body_for_content_types) | **post** /responseBody/postRefInNotResponseBodyForContentTypes |
[**post_ref_in_oneof_request_body**](#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody | [**post_ref_in_oneof_request_body**](#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody |
[**post_ref_in_oneof_response_body_for_content_types**](#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes | [**post_ref_in_oneof_response_body_for_content_types**](#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes |
[**post_ref_in_property_request_body**](#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody | [**post_ref_in_property_request_body**](#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody |
@ -10056,6 +10058,145 @@ No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) [[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_not_request_body**
<a name="post_ref_in_not_request_body"></a>
> post_ref_in_not_request_body(body)
### Example
```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.
configuration = unit_test_api.Configuration(
host = "https://someserver.com/v1"
)
# Enter a context with an instance of the API client
with unit_test_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = content_type_json_api.ContentTypeJsonApi(api_client)
# example passing only required values which don't have defaults set
body = None
try:
api_response = api_instance.post_ref_in_not_request_body(
body=body,
)
except unit_test_api.ApiException as e:
print("Exception when calling ContentTypeJsonApi->post_ref_in_not_request_body: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
body | typing.Union[SchemaForRequestBodyApplicationJson] | required |
content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body
stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
skip_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
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | 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 | success
#### ApiResponseFor200
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
body | Unset | body was not defined |
headers | Unset | headers were not defined |
void (empty response body)
### Authorization
No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_not_response_body_for_content_types**
<a name="post_ref_in_not_response_body_for_content_types"></a>
> bool, date, datetime, dict, float, int, list, str, none_type post_ref_in_not_response_body_for_content_types()
### Example
```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.
configuration = unit_test_api.Configuration(
host = "https://someserver.com/v1"
)
# Enter a context with an instance of the API client
with unit_test_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = content_type_json_api.ContentTypeJsonApi(api_client)
# example, this endpoint has no required or optional parameters
try:
api_response = api_instance.post_ref_in_not_response_body_for_content_types()
pprint(api_response)
except unit_test_api.ApiException as e:
print("Exception when calling ContentTypeJsonApi->post_ref_in_not_response_body_for_content_types: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return Types, Responses
Code | Class | Description
------------- | ------------- | -------------
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
200 | ApiResponseFor200 | success
#### ApiResponseFor200
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | |
headers | Unset | headers were not defined |
#### SchemaFor200ResponseBodyApplicationJson
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
**bool, date, datetime, dict, float, int, list, str, none_type**
### Authorization
No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_oneof_request_body** # **post_ref_in_oneof_request_body**
<a name="post_ref_in_oneof_request_body"></a> <a name="post_ref_in_oneof_request_body"></a>
> post_ref_in_oneof_request_body(ref_in_oneof) > post_ref_in_oneof_request_body(ref_in_oneof)

View File

@ -77,6 +77,7 @@ Method | HTTP request | Description
[**post_ref_in_allof_request_body**](#post_ref_in_allof_request_body) | **post** /requestBody/postRefInAllofRequestBody | [**post_ref_in_allof_request_body**](#post_ref_in_allof_request_body) | **post** /requestBody/postRefInAllofRequestBody |
[**post_ref_in_anyof_request_body**](#post_ref_in_anyof_request_body) | **post** /requestBody/postRefInAnyofRequestBody | [**post_ref_in_anyof_request_body**](#post_ref_in_anyof_request_body) | **post** /requestBody/postRefInAnyofRequestBody |
[**post_ref_in_items_request_body**](#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody | [**post_ref_in_items_request_body**](#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody |
[**post_ref_in_not_request_body**](#post_ref_in_not_request_body) | **post** /requestBody/postRefInNotRequestBody |
[**post_ref_in_oneof_request_body**](#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody | [**post_ref_in_oneof_request_body**](#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody |
[**post_ref_in_property_request_body**](#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody | [**post_ref_in_property_request_body**](#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody |
[**post_required_default_validation_request_body**](#post_required_default_validation_request_body) | **post** /requestBody/postRequiredDefaultValidationRequestBody | [**post_required_default_validation_request_body**](#post_required_default_validation_request_body) | **post** /requestBody/postRequiredDefaultValidationRequestBody |
@ -5430,6 +5431,81 @@ body | Unset | body was not defined |
headers | Unset | headers were not defined | headers | Unset | headers were not defined |
void (empty response body)
### Authorization
No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_not_request_body**
<a name="post_ref_in_not_request_body"></a>
> post_ref_in_not_request_body(body)
### Example
```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 pprint import pprint
# Defining the host is optional and defaults to https://someserver.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = unit_test_api.Configuration(
host = "https://someserver.com/v1"
)
# Enter a context with an instance of the API client
with unit_test_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = operation_request_body_api.OperationRequestBodyApi(api_client)
# example passing only required values which don't have defaults set
body = None
try:
api_response = api_instance.post_ref_in_not_request_body(
body=body,
)
except unit_test_api.ApiException as e:
print("Exception when calling OperationRequestBodyApi->post_ref_in_not_request_body: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
body | typing.Union[SchemaForRequestBodyApplicationJson] | required |
content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body
stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
skip_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
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | 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 | success
#### ApiResponseFor200
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
body | Unset | body was not defined |
headers | Unset | headers were not defined |
void (empty response body) void (empty response body)
### Authorization ### Authorization

View File

@ -149,6 +149,8 @@ Method | HTTP request | Description
[**post_ref_in_anyof_response_body_for_content_types**](#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes | [**post_ref_in_anyof_response_body_for_content_types**](#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes |
[**post_ref_in_items_request_body**](#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody | [**post_ref_in_items_request_body**](#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody |
[**post_ref_in_items_response_body_for_content_types**](#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes | [**post_ref_in_items_response_body_for_content_types**](#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes |
[**post_ref_in_not_request_body**](#post_ref_in_not_request_body) | **post** /requestBody/postRefInNotRequestBody |
[**post_ref_in_not_response_body_for_content_types**](#post_ref_in_not_response_body_for_content_types) | **post** /responseBody/postRefInNotResponseBodyForContentTypes |
[**post_ref_in_oneof_request_body**](#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody | [**post_ref_in_oneof_request_body**](#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody |
[**post_ref_in_oneof_response_body_for_content_types**](#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes | [**post_ref_in_oneof_response_body_for_content_types**](#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes |
[**post_ref_in_property_request_body**](#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody | [**post_ref_in_property_request_body**](#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody |
@ -10056,6 +10058,145 @@ No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) [[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_not_request_body**
<a name="post_ref_in_not_request_body"></a>
> post_ref_in_not_request_body(body)
### Example
```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.
configuration = unit_test_api.Configuration(
host = "https://someserver.com/v1"
)
# Enter a context with an instance of the API client
with unit_test_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = path_post_api.PathPostApi(api_client)
# example passing only required values which don't have defaults set
body = None
try:
api_response = api_instance.post_ref_in_not_request_body(
body=body,
)
except unit_test_api.ApiException as e:
print("Exception when calling PathPostApi->post_ref_in_not_request_body: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
body | typing.Union[SchemaForRequestBodyApplicationJson] | required |
content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body
stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
skip_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
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | 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 | success
#### ApiResponseFor200
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
body | Unset | body was not defined |
headers | Unset | headers were not defined |
void (empty response body)
### Authorization
No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_not_response_body_for_content_types**
<a name="post_ref_in_not_response_body_for_content_types"></a>
> bool, date, datetime, dict, float, int, list, str, none_type post_ref_in_not_response_body_for_content_types()
### Example
```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.
configuration = unit_test_api.Configuration(
host = "https://someserver.com/v1"
)
# Enter a context with an instance of the API client
with unit_test_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = path_post_api.PathPostApi(api_client)
# example, this endpoint has no required or optional parameters
try:
api_response = api_instance.post_ref_in_not_response_body_for_content_types()
pprint(api_response)
except unit_test_api.ApiException as e:
print("Exception when calling PathPostApi->post_ref_in_not_response_body_for_content_types: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return Types, Responses
Code | Class | Description
------------- | ------------- | -------------
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
200 | ApiResponseFor200 | success
#### ApiResponseFor200
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | |
headers | Unset | headers were not defined |
#### SchemaFor200ResponseBodyApplicationJson
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
**bool, date, datetime, dict, float, int, list, str, none_type**
### Authorization
No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_oneof_request_body** # **post_ref_in_oneof_request_body**
<a name="post_ref_in_oneof_request_body"></a> <a name="post_ref_in_oneof_request_body"></a>
> post_ref_in_oneof_request_body(ref_in_oneof) > post_ref_in_oneof_request_body(ref_in_oneof)

View File

@ -15,6 +15,8 @@ Method | HTTP request | Description
[**post_ref_in_anyof_response_body_for_content_types**](#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes | [**post_ref_in_anyof_response_body_for_content_types**](#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes |
[**post_ref_in_items_request_body**](#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody | [**post_ref_in_items_request_body**](#post_ref_in_items_request_body) | **post** /requestBody/postRefInItemsRequestBody |
[**post_ref_in_items_response_body_for_content_types**](#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes | [**post_ref_in_items_response_body_for_content_types**](#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes |
[**post_ref_in_not_request_body**](#post_ref_in_not_request_body) | **post** /requestBody/postRefInNotRequestBody |
[**post_ref_in_not_response_body_for_content_types**](#post_ref_in_not_response_body_for_content_types) | **post** /responseBody/postRefInNotResponseBodyForContentTypes |
[**post_ref_in_oneof_request_body**](#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody | [**post_ref_in_oneof_request_body**](#post_ref_in_oneof_request_body) | **post** /requestBody/postRefInOneofRequestBody |
[**post_ref_in_oneof_response_body_for_content_types**](#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes | [**post_ref_in_oneof_response_body_for_content_types**](#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes |
[**post_ref_in_property_request_body**](#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody | [**post_ref_in_property_request_body**](#post_ref_in_property_request_body) | **post** /requestBody/postRefInPropertyRequestBody |
@ -709,6 +711,145 @@ No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) [[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_not_request_body**
<a name="post_ref_in_not_request_body"></a>
> post_ref_in_not_request_body(body)
### Example
```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.
configuration = unit_test_api.Configuration(
host = "https://someserver.com/v1"
)
# Enter a context with an instance of the API client
with unit_test_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ref_api.RefApi(api_client)
# example passing only required values which don't have defaults set
body = None
try:
api_response = api_instance.post_ref_in_not_request_body(
body=body,
)
except unit_test_api.ApiException as e:
print("Exception when calling RefApi->post_ref_in_not_request_body: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
body | typing.Union[SchemaForRequestBodyApplicationJson] | required |
content_type | str | optional, default is 'application/json' | Selects the schema and serialization of the request body
stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
skip_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
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | 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 | success
#### ApiResponseFor200
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
body | Unset | body was not defined |
headers | Unset | headers were not defined |
void (empty response body)
### Authorization
No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_not_response_body_for_content_types**
<a name="post_ref_in_not_response_body_for_content_types"></a>
> bool, date, datetime, dict, float, int, list, str, none_type post_ref_in_not_response_body_for_content_types()
### Example
```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.
configuration = unit_test_api.Configuration(
host = "https://someserver.com/v1"
)
# Enter a context with an instance of the API client
with unit_test_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = ref_api.RefApi(api_client)
# example, this endpoint has no required or optional parameters
try:
api_response = api_instance.post_ref_in_not_response_body_for_content_types()
pprint(api_response)
except unit_test_api.ApiException as e:
print("Exception when calling RefApi->post_ref_in_not_response_body_for_content_types: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return Types, Responses
Code | Class | Description
------------- | ------------- | -------------
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
200 | ApiResponseFor200 | success
#### ApiResponseFor200
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | |
headers | Unset | headers were not defined |
#### SchemaFor200ResponseBodyApplicationJson
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
**bool, date, datetime, dict, float, int, list, str, none_type**
### Authorization
No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_oneof_request_body** # **post_ref_in_oneof_request_body**
<a name="post_ref_in_oneof_request_body"></a> <a name="post_ref_in_oneof_request_body"></a>
> post_ref_in_oneof_request_body(ref_in_oneof) > post_ref_in_oneof_request_body(ref_in_oneof)

View File

@ -77,6 +77,7 @@ Method | HTTP request | Description
[**post_ref_in_allof_response_body_for_content_types**](#post_ref_in_allof_response_body_for_content_types) | **post** /responseBody/postRefInAllofResponseBodyForContentTypes | [**post_ref_in_allof_response_body_for_content_types**](#post_ref_in_allof_response_body_for_content_types) | **post** /responseBody/postRefInAllofResponseBodyForContentTypes |
[**post_ref_in_anyof_response_body_for_content_types**](#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes | [**post_ref_in_anyof_response_body_for_content_types**](#post_ref_in_anyof_response_body_for_content_types) | **post** /responseBody/postRefInAnyofResponseBodyForContentTypes |
[**post_ref_in_items_response_body_for_content_types**](#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes | [**post_ref_in_items_response_body_for_content_types**](#post_ref_in_items_response_body_for_content_types) | **post** /responseBody/postRefInItemsResponseBodyForContentTypes |
[**post_ref_in_not_response_body_for_content_types**](#post_ref_in_not_response_body_for_content_types) | **post** /responseBody/postRefInNotResponseBodyForContentTypes |
[**post_ref_in_oneof_response_body_for_content_types**](#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes | [**post_ref_in_oneof_response_body_for_content_types**](#post_ref_in_oneof_response_body_for_content_types) | **post** /responseBody/postRefInOneofResponseBodyForContentTypes |
[**post_ref_in_property_response_body_for_content_types**](#post_ref_in_property_response_body_for_content_types) | **post** /responseBody/postRefInPropertyResponseBodyForContentTypes | [**post_ref_in_property_response_body_for_content_types**](#post_ref_in_property_response_body_for_content_types) | **post** /responseBody/postRefInPropertyResponseBodyForContentTypes |
[**post_required_default_validation_response_body_for_content_types**](#post_required_default_validation_response_body_for_content_types) | **post** /responseBody/postRequiredDefaultValidationResponseBodyForContentTypes | [**post_required_default_validation_response_body_for_content_types**](#post_required_default_validation_response_body_for_content_types) | **post** /responseBody/postRequiredDefaultValidationResponseBodyForContentTypes |
@ -4624,6 +4625,70 @@ No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md) [[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_not_response_body_for_content_types**
<a name="post_ref_in_not_response_body_for_content_types"></a>
> bool, date, datetime, dict, float, int, list, str, none_type post_ref_in_not_response_body_for_content_types()
### Example
```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.
configuration = unit_test_api.Configuration(
host = "https://someserver.com/v1"
)
# Enter a context with an instance of the API client
with unit_test_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = response_content_content_type_schema_api.ResponseContentContentTypeSchemaApi(api_client)
# example, this endpoint has no required or optional parameters
try:
api_response = api_instance.post_ref_in_not_response_body_for_content_types()
pprint(api_response)
except unit_test_api.ApiException as e:
print("Exception when calling ResponseContentContentTypeSchemaApi->post_ref_in_not_response_body_for_content_types: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return Types, Responses
Code | Class | Description
------------- | ------------- | -------------
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
200 | ApiResponseFor200 | success
#### ApiResponseFor200
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
body | typing.Union[SchemaFor200ResponseBodyApplicationJson, ] | |
headers | Unset | headers were not defined |
#### SchemaFor200ResponseBodyApplicationJson
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
**bool, date, datetime, dict, float, int, list, str, none_type**
### Authorization
No authorization required
[[Back to top]](#__pageTop) [[Back to API list]](../../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../../README.md#documentation-for-models) [[Back to README]](../../../README.md)
# **post_ref_in_oneof_response_body_for_content_types** # **post_ref_in_oneof_response_body_for_content_types**
<a name="post_ref_in_oneof_response_body_for_content_types"></a> <a name="post_ref_in_oneof_response_body_for_content_types"></a>
> RefInOneof post_ref_in_oneof_response_body_for_content_types() > RefInOneof post_ref_in_oneof_response_body_for_content_types()

View File

@ -0,0 +1,9 @@
# unit_test_api.model.ref_in_not.RefInNot
#### Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | 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)

View File

@ -0,0 +1,46 @@
# 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.ref_in_not import RefInNot
from unit_test_api import configuration
class TestRefInNot(unittest.TestCase):
"""RefInNot unit test stubs"""
_configuration = configuration.Configuration()
def test_property_named_ref_valid_passes(self):
# property named $ref valid
RefInNot._from_openapi_data(
{
"$ref":
2,
},
_configuration=self._configuration
)
def test_property_named_ref_invalid_fails(self):
# property named $ref invalid
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
RefInNot._from_openapi_data(
{
"$ref":
"a",
},
_configuration=self._configuration
)
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,91 @@
# coding: utf-8
"""
Generated by: https://openapi-generator.tech
"""
import unittest
from unittest.mock import patch
import urllib3
import unit_test_api
from unit_test_api.paths.request_body_post_ref_in_not_request_body import post # noqa: E501
from unit_test_api import configuration, schemas, api_client
from .. import ApiTestMixin
class TestRequestBodyPostRefInNotRequestBody(ApiTestMixin, unittest.TestCase):
"""
RequestBodyPostRefInNotRequestBody unit test stubs
"""
_configuration = configuration.Configuration()
def setUp(self):
used_api_client = api_client.ApiClient(configuration=self._configuration)
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
def tearDown(self):
pass
response_status = 200
response_body = ''
def test_property_named_ref_valid_passes(self):
content_type = 'application/json'
# property named $ref valid
with patch.object(urllib3.PoolManager, 'request') as mock_request:
payload = (
{
"$ref":
2,
}
)
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
payload,
_configuration=self._configuration
)
mock_request.return_value = self.response(
self.json_bytes(self.response_body),
status=self.response_status
)
api_response = self.api.post(
body=body,
content_type=content_type
)
self.assert_pool_manager_request_called_with(
mock_request,
self._configuration.host + '/requestBody/postRefInNotRequestBody',
method='post'.upper(),
body=self.json_bytes(payload),
content_type=content_type,
)
assert isinstance(api_response.response, urllib3.HTTPResponse)
assert isinstance(api_response.body, schemas.Unset)
def test_property_named_ref_invalid_fails(self):
content_type = 'application/json'
# property named $ref invalid
with patch.object(urllib3.PoolManager, 'request') as mock_request:
payload = (
{
"$ref":
"a",
}
)
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
payload,
_configuration=self._configuration
)
self.api.post(body=body)
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,100 @@
# coding: utf-8
"""
Generated by: https://openapi-generator.tech
"""
import unittest
from unittest.mock import patch
import urllib3
import unit_test_api
from unit_test_api.paths.response_body_post_ref_in_not_response_body_for_content_types import post # noqa: E501
from unit_test_api import configuration, schemas, api_client
from .. import ApiTestMixin
class TestResponseBodyPostRefInNotResponseBodyForContentTypes(ApiTestMixin, unittest.TestCase):
"""
ResponseBodyPostRefInNotResponseBodyForContentTypes unit test stubs
"""
_configuration = configuration.Configuration()
def setUp(self):
used_api_client = api_client.ApiClient(configuration=self._configuration)
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
def tearDown(self):
pass
response_status = 200
def test_property_named_ref_valid_passes(self):
# property named $ref valid
accept_content_type = 'application/json'
with patch.object(urllib3.PoolManager, 'request') as mock_request:
payload = (
{
"$ref":
2,
}
)
mock_request.return_value = self.response(
self.json_bytes(payload),
status=self.response_status
)
api_response = self.api.post(
accept_content_types=(accept_content_type,)
)
self.assert_pool_manager_request_called_with(
mock_request,
self._configuration.host + '/responseBody/postRefInNotResponseBodyForContentTypes',
method='post'.upper(),
accept_content_type=accept_content_type,
)
assert isinstance(api_response.response, urllib3.HTTPResponse)
assert isinstance(api_response.body, post.SchemaFor200ResponseBodyApplicationJson)
deserialized_response_body = post.SchemaFor200ResponseBodyApplicationJson._from_openapi_data(
payload,
_configuration=self._configuration
)
assert api_response.body == deserialized_response_body
def test_property_named_ref_invalid_fails(self):
# property named $ref invalid
accept_content_type = 'application/json'
with patch.object(urllib3.PoolManager, 'request') as mock_request:
payload = (
{
"$ref":
"a",
}
)
mock_request.return_value = self.response(
self.json_bytes(payload),
status=self.response_status
)
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
self.api.post(
accept_content_types=(accept_content_type,)
)
self.assert_pool_manager_request_called_with(
mock_request,
self._configuration.host + '/responseBody/postRefInNotResponseBodyForContentTypes',
method='post'.upper(),
content_type=None,
accept_content_type=accept_content_type,
)
if __name__ == '__main__':
unittest.main()

View File

@ -147,6 +147,8 @@ from unit_test_api.apis.paths.request_body_post_ref_in_oneof_request_body import
from unit_test_api.apis.paths.response_body_post_ref_in_oneof_response_body_for_content_types import ResponseBodyPostRefInOneofResponseBodyForContentTypes from unit_test_api.apis.paths.response_body_post_ref_in_oneof_response_body_for_content_types import ResponseBodyPostRefInOneofResponseBodyForContentTypes
from unit_test_api.apis.paths.request_body_post_ref_in_anyof_request_body import RequestBodyPostRefInAnyofRequestBody from unit_test_api.apis.paths.request_body_post_ref_in_anyof_request_body import RequestBodyPostRefInAnyofRequestBody
from unit_test_api.apis.paths.response_body_post_ref_in_anyof_response_body_for_content_types import ResponseBodyPostRefInAnyofResponseBodyForContentTypes from unit_test_api.apis.paths.response_body_post_ref_in_anyof_response_body_for_content_types import ResponseBodyPostRefInAnyofResponseBodyForContentTypes
from unit_test_api.apis.paths.request_body_post_ref_in_not_request_body import RequestBodyPostRefInNotRequestBody
from unit_test_api.apis.paths.response_body_post_ref_in_not_response_body_for_content_types import ResponseBodyPostRefInNotResponseBodyForContentTypes
from unit_test_api.apis.paths.request_body_post_required_validation_request_body import RequestBodyPostRequiredValidationRequestBody from unit_test_api.apis.paths.request_body_post_required_validation_request_body import RequestBodyPostRequiredValidationRequestBody
from unit_test_api.apis.paths.response_body_post_required_validation_response_body_for_content_types import ResponseBodyPostRequiredValidationResponseBodyForContentTypes from unit_test_api.apis.paths.response_body_post_required_validation_response_body_for_content_types import ResponseBodyPostRequiredValidationResponseBodyForContentTypes
from unit_test_api.apis.paths.request_body_post_required_default_validation_request_body import RequestBodyPostRequiredDefaultValidationRequestBody from unit_test_api.apis.paths.request_body_post_required_default_validation_request_body import RequestBodyPostRequiredDefaultValidationRequestBody
@ -323,6 +325,8 @@ PathToApi = typing.TypedDict(
PathValues.RESPONSE_BODY_POST_REF_IN_ONEOF_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInOneofResponseBodyForContentTypes, PathValues.RESPONSE_BODY_POST_REF_IN_ONEOF_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInOneofResponseBodyForContentTypes,
PathValues.REQUEST_BODY_POST_REF_IN_ANYOF_REQUEST_BODY: RequestBodyPostRefInAnyofRequestBody, PathValues.REQUEST_BODY_POST_REF_IN_ANYOF_REQUEST_BODY: RequestBodyPostRefInAnyofRequestBody,
PathValues.RESPONSE_BODY_POST_REF_IN_ANYOF_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInAnyofResponseBodyForContentTypes, PathValues.RESPONSE_BODY_POST_REF_IN_ANYOF_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInAnyofResponseBodyForContentTypes,
PathValues.REQUEST_BODY_POST_REF_IN_NOT_REQUEST_BODY: RequestBodyPostRefInNotRequestBody,
PathValues.RESPONSE_BODY_POST_REF_IN_NOT_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInNotResponseBodyForContentTypes,
PathValues.REQUEST_BODY_POST_REQUIRED_VALIDATION_REQUEST_BODY: RequestBodyPostRequiredValidationRequestBody, PathValues.REQUEST_BODY_POST_REQUIRED_VALIDATION_REQUEST_BODY: RequestBodyPostRequiredValidationRequestBody,
PathValues.RESPONSE_BODY_POST_REQUIRED_VALIDATION_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRequiredValidationResponseBodyForContentTypes, PathValues.RESPONSE_BODY_POST_REQUIRED_VALIDATION_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRequiredValidationResponseBodyForContentTypes,
PathValues.REQUEST_BODY_POST_REQUIRED_DEFAULT_VALIDATION_REQUEST_BODY: RequestBodyPostRequiredDefaultValidationRequestBody, PathValues.REQUEST_BODY_POST_REQUIRED_DEFAULT_VALIDATION_REQUEST_BODY: RequestBodyPostRequiredDefaultValidationRequestBody,
@ -500,6 +504,8 @@ path_to_api = PathToApi(
PathValues.RESPONSE_BODY_POST_REF_IN_ONEOF_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInOneofResponseBodyForContentTypes, PathValues.RESPONSE_BODY_POST_REF_IN_ONEOF_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInOneofResponseBodyForContentTypes,
PathValues.REQUEST_BODY_POST_REF_IN_ANYOF_REQUEST_BODY: RequestBodyPostRefInAnyofRequestBody, PathValues.REQUEST_BODY_POST_REF_IN_ANYOF_REQUEST_BODY: RequestBodyPostRefInAnyofRequestBody,
PathValues.RESPONSE_BODY_POST_REF_IN_ANYOF_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInAnyofResponseBodyForContentTypes, PathValues.RESPONSE_BODY_POST_REF_IN_ANYOF_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInAnyofResponseBodyForContentTypes,
PathValues.REQUEST_BODY_POST_REF_IN_NOT_REQUEST_BODY: RequestBodyPostRefInNotRequestBody,
PathValues.RESPONSE_BODY_POST_REF_IN_NOT_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRefInNotResponseBodyForContentTypes,
PathValues.REQUEST_BODY_POST_REQUIRED_VALIDATION_REQUEST_BODY: RequestBodyPostRequiredValidationRequestBody, PathValues.REQUEST_BODY_POST_REQUIRED_VALIDATION_REQUEST_BODY: RequestBodyPostRequiredValidationRequestBody,
PathValues.RESPONSE_BODY_POST_REQUIRED_VALIDATION_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRequiredValidationResponseBodyForContentTypes, PathValues.RESPONSE_BODY_POST_REQUIRED_VALIDATION_RESPONSE_BODY_FOR_CONTENT_TYPES: ResponseBodyPostRequiredValidationResponseBodyForContentTypes,
PathValues.REQUEST_BODY_POST_REQUIRED_DEFAULT_VALIDATION_REQUEST_BODY: RequestBodyPostRequiredDefaultValidationRequestBody, PathValues.REQUEST_BODY_POST_REQUIRED_DEFAULT_VALIDATION_REQUEST_BODY: RequestBodyPostRequiredDefaultValidationRequestBody,

View File

@ -0,0 +1,7 @@
from unit_test_api.paths.request_body_post_ref_in_not_request_body.post import ApiForpost
class RequestBodyPostRefInNotRequestBody(
ApiForpost,
):
pass

View File

@ -0,0 +1,7 @@
from unit_test_api.paths.response_body_post_ref_in_not_response_body_for_content_types.post import ApiForpost
class ResponseBodyPostRefInNotResponseBodyForContentTypes(
ApiForpost,
):
pass

View File

@ -153,6 +153,8 @@ from unit_test_api.paths.request_body_post_ref_in_anyof_request_body.post import
from unit_test_api.paths.response_body_post_ref_in_anyof_response_body_for_content_types.post import PostRefInAnyofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_anyof_response_body_for_content_types.post import PostRefInAnyofResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_items_request_body.post import PostRefInItemsRequestBody from unit_test_api.paths.request_body_post_ref_in_items_request_body.post import PostRefInItemsRequestBody
from unit_test_api.paths.response_body_post_ref_in_items_response_body_for_content_types.post import PostRefInItemsResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_items_response_body_for_content_types.post import PostRefInItemsResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_not_request_body.post import PostRefInNotRequestBody
from unit_test_api.paths.response_body_post_ref_in_not_response_body_for_content_types.post import PostRefInNotResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_oneof_request_body.post import PostRefInOneofRequestBody from unit_test_api.paths.request_body_post_ref_in_oneof_request_body.post import PostRefInOneofRequestBody
from unit_test_api.paths.response_body_post_ref_in_oneof_response_body_for_content_types.post import PostRefInOneofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_oneof_response_body_for_content_types.post import PostRefInOneofResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_property_request_body.post import PostRefInPropertyRequestBody from unit_test_api.paths.request_body_post_ref_in_property_request_body.post import PostRefInPropertyRequestBody
@ -328,6 +330,8 @@ class ContentTypeJsonApi(
PostRefInAnyofResponseBodyForContentTypes, PostRefInAnyofResponseBodyForContentTypes,
PostRefInItemsRequestBody, PostRefInItemsRequestBody,
PostRefInItemsResponseBodyForContentTypes, PostRefInItemsResponseBodyForContentTypes,
PostRefInNotRequestBody,
PostRefInNotResponseBodyForContentTypes,
PostRefInOneofRequestBody, PostRefInOneofRequestBody,
PostRefInOneofResponseBodyForContentTypes, PostRefInOneofResponseBodyForContentTypes,
PostRefInPropertyRequestBody, PostRefInPropertyRequestBody,

View File

@ -81,6 +81,7 @@ from unit_test_api.paths.request_body_post_ref_in_additionalproperties_request_b
from unit_test_api.paths.request_body_post_ref_in_allof_request_body.post import PostRefInAllofRequestBody from unit_test_api.paths.request_body_post_ref_in_allof_request_body.post import PostRefInAllofRequestBody
from unit_test_api.paths.request_body_post_ref_in_anyof_request_body.post import PostRefInAnyofRequestBody from unit_test_api.paths.request_body_post_ref_in_anyof_request_body.post import PostRefInAnyofRequestBody
from unit_test_api.paths.request_body_post_ref_in_items_request_body.post import PostRefInItemsRequestBody from unit_test_api.paths.request_body_post_ref_in_items_request_body.post import PostRefInItemsRequestBody
from unit_test_api.paths.request_body_post_ref_in_not_request_body.post import PostRefInNotRequestBody
from unit_test_api.paths.request_body_post_ref_in_oneof_request_body.post import PostRefInOneofRequestBody from unit_test_api.paths.request_body_post_ref_in_oneof_request_body.post import PostRefInOneofRequestBody
from unit_test_api.paths.request_body_post_ref_in_property_request_body.post import PostRefInPropertyRequestBody from unit_test_api.paths.request_body_post_ref_in_property_request_body.post import PostRefInPropertyRequestBody
from unit_test_api.paths.request_body_post_required_default_validation_request_body.post import PostRequiredDefaultValidationRequestBody from unit_test_api.paths.request_body_post_required_default_validation_request_body.post import PostRequiredDefaultValidationRequestBody
@ -170,6 +171,7 @@ class OperationRequestBodyApi(
PostRefInAllofRequestBody, PostRefInAllofRequestBody,
PostRefInAnyofRequestBody, PostRefInAnyofRequestBody,
PostRefInItemsRequestBody, PostRefInItemsRequestBody,
PostRefInNotRequestBody,
PostRefInOneofRequestBody, PostRefInOneofRequestBody,
PostRefInPropertyRequestBody, PostRefInPropertyRequestBody,
PostRequiredDefaultValidationRequestBody, PostRequiredDefaultValidationRequestBody,

View File

@ -153,6 +153,8 @@ from unit_test_api.paths.request_body_post_ref_in_anyof_request_body.post import
from unit_test_api.paths.response_body_post_ref_in_anyof_response_body_for_content_types.post import PostRefInAnyofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_anyof_response_body_for_content_types.post import PostRefInAnyofResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_items_request_body.post import PostRefInItemsRequestBody from unit_test_api.paths.request_body_post_ref_in_items_request_body.post import PostRefInItemsRequestBody
from unit_test_api.paths.response_body_post_ref_in_items_response_body_for_content_types.post import PostRefInItemsResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_items_response_body_for_content_types.post import PostRefInItemsResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_not_request_body.post import PostRefInNotRequestBody
from unit_test_api.paths.response_body_post_ref_in_not_response_body_for_content_types.post import PostRefInNotResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_oneof_request_body.post import PostRefInOneofRequestBody from unit_test_api.paths.request_body_post_ref_in_oneof_request_body.post import PostRefInOneofRequestBody
from unit_test_api.paths.response_body_post_ref_in_oneof_response_body_for_content_types.post import PostRefInOneofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_oneof_response_body_for_content_types.post import PostRefInOneofResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_property_request_body.post import PostRefInPropertyRequestBody from unit_test_api.paths.request_body_post_ref_in_property_request_body.post import PostRefInPropertyRequestBody
@ -328,6 +330,8 @@ class PathPostApi(
PostRefInAnyofResponseBodyForContentTypes, PostRefInAnyofResponseBodyForContentTypes,
PostRefInItemsRequestBody, PostRefInItemsRequestBody,
PostRefInItemsResponseBodyForContentTypes, PostRefInItemsResponseBodyForContentTypes,
PostRefInNotRequestBody,
PostRefInNotResponseBodyForContentTypes,
PostRefInOneofRequestBody, PostRefInOneofRequestBody,
PostRefInOneofResponseBodyForContentTypes, PostRefInOneofResponseBodyForContentTypes,
PostRefInPropertyRequestBody, PostRefInPropertyRequestBody,

View File

@ -19,6 +19,8 @@ from unit_test_api.paths.request_body_post_ref_in_anyof_request_body.post import
from unit_test_api.paths.response_body_post_ref_in_anyof_response_body_for_content_types.post import PostRefInAnyofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_anyof_response_body_for_content_types.post import PostRefInAnyofResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_items_request_body.post import PostRefInItemsRequestBody from unit_test_api.paths.request_body_post_ref_in_items_request_body.post import PostRefInItemsRequestBody
from unit_test_api.paths.response_body_post_ref_in_items_response_body_for_content_types.post import PostRefInItemsResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_items_response_body_for_content_types.post import PostRefInItemsResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_not_request_body.post import PostRefInNotRequestBody
from unit_test_api.paths.response_body_post_ref_in_not_response_body_for_content_types.post import PostRefInNotResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_oneof_request_body.post import PostRefInOneofRequestBody from unit_test_api.paths.request_body_post_ref_in_oneof_request_body.post import PostRefInOneofRequestBody
from unit_test_api.paths.response_body_post_ref_in_oneof_response_body_for_content_types.post import PostRefInOneofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_oneof_response_body_for_content_types.post import PostRefInOneofResponseBodyForContentTypes
from unit_test_api.paths.request_body_post_ref_in_property_request_body.post import PostRefInPropertyRequestBody from unit_test_api.paths.request_body_post_ref_in_property_request_body.post import PostRefInPropertyRequestBody
@ -36,6 +38,8 @@ class RefApi(
PostRefInAnyofResponseBodyForContentTypes, PostRefInAnyofResponseBodyForContentTypes,
PostRefInItemsRequestBody, PostRefInItemsRequestBody,
PostRefInItemsResponseBodyForContentTypes, PostRefInItemsResponseBodyForContentTypes,
PostRefInNotRequestBody,
PostRefInNotResponseBodyForContentTypes,
PostRefInOneofRequestBody, PostRefInOneofRequestBody,
PostRefInOneofResponseBodyForContentTypes, PostRefInOneofResponseBodyForContentTypes,
PostRefInPropertyRequestBody, PostRefInPropertyRequestBody,

View File

@ -81,6 +81,7 @@ from unit_test_api.paths.response_body_post_ref_in_additionalproperties_response
from unit_test_api.paths.response_body_post_ref_in_allof_response_body_for_content_types.post import PostRefInAllofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_allof_response_body_for_content_types.post import PostRefInAllofResponseBodyForContentTypes
from unit_test_api.paths.response_body_post_ref_in_anyof_response_body_for_content_types.post import PostRefInAnyofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_anyof_response_body_for_content_types.post import PostRefInAnyofResponseBodyForContentTypes
from unit_test_api.paths.response_body_post_ref_in_items_response_body_for_content_types.post import PostRefInItemsResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_items_response_body_for_content_types.post import PostRefInItemsResponseBodyForContentTypes
from unit_test_api.paths.response_body_post_ref_in_not_response_body_for_content_types.post import PostRefInNotResponseBodyForContentTypes
from unit_test_api.paths.response_body_post_ref_in_oneof_response_body_for_content_types.post import PostRefInOneofResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_oneof_response_body_for_content_types.post import PostRefInOneofResponseBodyForContentTypes
from unit_test_api.paths.response_body_post_ref_in_property_response_body_for_content_types.post import PostRefInPropertyResponseBodyForContentTypes from unit_test_api.paths.response_body_post_ref_in_property_response_body_for_content_types.post import PostRefInPropertyResponseBodyForContentTypes
from unit_test_api.paths.response_body_post_required_default_validation_response_body_for_content_types.post import PostRequiredDefaultValidationResponseBodyForContentTypes from unit_test_api.paths.response_body_post_required_default_validation_response_body_for_content_types.post import PostRequiredDefaultValidationResponseBodyForContentTypes
@ -170,6 +171,7 @@ class ResponseContentContentTypeSchemaApi(
PostRefInAllofResponseBodyForContentTypes, PostRefInAllofResponseBodyForContentTypes,
PostRefInAnyofResponseBodyForContentTypes, PostRefInAnyofResponseBodyForContentTypes,
PostRefInItemsResponseBodyForContentTypes, PostRefInItemsResponseBodyForContentTypes,
PostRefInNotResponseBodyForContentTypes,
PostRefInOneofResponseBodyForContentTypes, PostRefInOneofResponseBodyForContentTypes,
PostRefInPropertyResponseBodyForContentTypes, PostRefInPropertyResponseBodyForContentTypes,
PostRequiredDefaultValidationResponseBodyForContentTypes, PostRequiredDefaultValidationResponseBodyForContentTypes,

View File

@ -0,0 +1,115 @@
# 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 re # noqa: F401
import sys # noqa: F401
import typing # noqa: F401
import functools # noqa: F401
from frozendict import frozendict # noqa: F401
import decimal # noqa: F401
from datetime import date, datetime # noqa: F401
from frozendict import frozendict # noqa: F401
from unit_test_api.schemas import ( # noqa: F401
AnyTypeSchema,
ComposedSchema,
DictSchema,
ListSchema,
StrSchema,
IntSchema,
Int32Schema,
Int64Schema,
Float32Schema,
Float64Schema,
NumberSchema,
UUIDSchema,
DateSchema,
DateTimeSchema,
DecimalSchema,
BoolSchema,
BinarySchema,
NoneSchema,
none_type,
Configuration,
Unset,
unset,
ComposedBase,
ListBase,
DictBase,
NoneBase,
StrBase,
IntBase,
Int32Base,
Int64Base,
Float32Base,
Float64Base,
NumberBase,
UUIDBase,
DateBase,
DateTimeBase,
BoolBase,
BinaryBase,
Schema,
NoneClass,
BoolClass,
_SchemaValidator,
_SchemaTypeChecker,
_SchemaEnumMaker
)
class RefInNot(
ComposedSchema
):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
@classmethod
@property
@functools.cache
def _composed_schemas(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 {
'allOf': [
],
'oneOf': [
],
'anyOf': [
],
'not':
PropertyNamedRefThatIsNotAReference
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[Configuration] = None,
**kwargs: typing.Type[Schema],
) -> 'RefInNot':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference

View File

@ -82,6 +82,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_allof import RefInAllof
from unit_test_api.model.ref_in_anyof import RefInAnyof 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_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_oneof import RefInOneof
from unit_test_api.model.ref_in_property import RefInProperty from unit_test_api.model.ref_in_property import RefInProperty
from unit_test_api.model.required_default_validation import RequiredDefaultValidation from unit_test_api.model.required_default_validation import RequiredDefaultValidation

View File

@ -152,6 +152,8 @@ class PathValues(str, enum.Enum):
RESPONSE_BODY_POST_REF_IN_ONEOF_RESPONSE_BODY_FOR_CONTENT_TYPES = "/responseBody/postRefInOneofResponseBodyForContentTypes" RESPONSE_BODY_POST_REF_IN_ONEOF_RESPONSE_BODY_FOR_CONTENT_TYPES = "/responseBody/postRefInOneofResponseBodyForContentTypes"
REQUEST_BODY_POST_REF_IN_ANYOF_REQUEST_BODY = "/requestBody/postRefInAnyofRequestBody" REQUEST_BODY_POST_REF_IN_ANYOF_REQUEST_BODY = "/requestBody/postRefInAnyofRequestBody"
RESPONSE_BODY_POST_REF_IN_ANYOF_RESPONSE_BODY_FOR_CONTENT_TYPES = "/responseBody/postRefInAnyofResponseBodyForContentTypes" RESPONSE_BODY_POST_REF_IN_ANYOF_RESPONSE_BODY_FOR_CONTENT_TYPES = "/responseBody/postRefInAnyofResponseBodyForContentTypes"
REQUEST_BODY_POST_REF_IN_NOT_REQUEST_BODY = "/requestBody/postRefInNotRequestBody"
RESPONSE_BODY_POST_REF_IN_NOT_RESPONSE_BODY_FOR_CONTENT_TYPES = "/responseBody/postRefInNotResponseBodyForContentTypes"
REQUEST_BODY_POST_REQUIRED_VALIDATION_REQUEST_BODY = "/requestBody/postRequiredValidationRequestBody" REQUEST_BODY_POST_REQUIRED_VALIDATION_REQUEST_BODY = "/requestBody/postRequiredValidationRequestBody"
RESPONSE_BODY_POST_REQUIRED_VALIDATION_RESPONSE_BODY_FOR_CONTENT_TYPES = "/responseBody/postRequiredValidationResponseBodyForContentTypes" RESPONSE_BODY_POST_REQUIRED_VALIDATION_RESPONSE_BODY_FOR_CONTENT_TYPES = "/responseBody/postRequiredValidationResponseBodyForContentTypes"
REQUEST_BODY_POST_REQUIRED_DEFAULT_VALIDATION_REQUEST_BODY = "/requestBody/postRequiredDefaultValidationRequestBody" REQUEST_BODY_POST_REQUIRED_DEFAULT_VALIDATION_REQUEST_BODY = "/requestBody/postRequiredDefaultValidationRequestBody"

View File

@ -0,0 +1,7 @@
# do not import all endpoints into this module because that uses a lot of memory and stack frames
# if you need the ability to import all endpoints from this module, import them with
# from unit_test_api.paths.request_body_post_ref_in_not_request_body import Api
from unit_test_api.paths import PathValues
path = PathValues.REQUEST_BODY_POST_REF_IN_NOT_REQUEST_BODY

View File

@ -0,0 +1,244 @@
# coding: utf-8
"""
Generated by: https://openapi-generator.tech
"""
from dataclasses import dataclass
import re # noqa: F401
import sys # noqa: F401
import typing
import urllib3
import functools # noqa: F401
from urllib3._collections import HTTPHeaderDict
from unit_test_api import api_client, exceptions
import decimal # noqa: F401
from datetime import date, datetime # noqa: F401
from frozendict import frozendict # noqa: F401
from unit_test_api.schemas import ( # noqa: F401
AnyTypeSchema,
ComposedSchema,
DictSchema,
ListSchema,
StrSchema,
IntSchema,
Int32Schema,
Int64Schema,
Float32Schema,
Float64Schema,
NumberSchema,
UUIDSchema,
DateSchema,
DateTimeSchema,
DecimalSchema,
BoolSchema,
BinarySchema,
NoneSchema,
none_type,
Configuration,
Unset,
unset,
ComposedBase,
ListBase,
DictBase,
NoneBase,
StrBase,
IntBase,
Int32Base,
Int64Base,
Float32Base,
Float64Base,
NumberBase,
UUIDBase,
DateBase,
DateTimeBase,
BoolBase,
BinaryBase,
Schema,
NoneClass,
BoolClass,
_SchemaValidator,
_SchemaTypeChecker,
_SchemaEnumMaker
)
from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference
from . import path
# body param
class SchemaForRequestBodyApplicationJson(
ComposedSchema
):
@classmethod
@property
@functools.cache
def _composed_schemas(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 {
'allOf': [
],
'oneOf': [
],
'anyOf': [
],
'not':
PropertyNamedRefThatIsNotAReference
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[Configuration] = None,
**kwargs: typing.Type[Schema],
) -> '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: Unset = unset
headers: Unset = unset
_response_for_200 = api_client.OpenApiResponse(
response_cls=ApiResponseFor200,
)
_status_code_to_response = {
'200': _response_for_200,
}
class BaseApi(api_client.Api):
def _post_ref_in_not_request_body(
self: api_client.Api,
body: typing.Union[SchemaForRequestBodyApplicationJson],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
"""
:param skip_deserialization: If true then api_response.response will be set but
api_response.body and api_response.headers will not be deserialized into schema
class instances
"""
used_path = path.value
_headers = HTTPHeaderDict()
# TODO add cookie handling
if body is unset:
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
def post_ref_in_not_request_body(
self: BaseApi,
body: typing.Union[SchemaForRequestBodyApplicationJson],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
return self._post_ref_in_not_request_body(
body=body,
content_type=content_type,
stream=stream,
timeout=timeout,
skip_deserialization=skip_deserialization
)
class ApiForpost(BaseApi):
# this class is used by api classes that refer to endpoints by path and http method names
def post(
self: BaseApi,
body: typing.Union[SchemaForRequestBodyApplicationJson],
content_type: str = 'application/json',
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
return self._post_ref_in_not_request_body(
body=body,
content_type=content_type,
stream=stream,
timeout=timeout,
skip_deserialization=skip_deserialization
)

View File

@ -0,0 +1,7 @@
# do not import all endpoints into this module because that uses a lot of memory and stack frames
# if you need the ability to import all endpoints from this module, import them with
# from unit_test_api.paths.response_body_post_ref_in_not_response_body_for_content_types import Api
from unit_test_api.paths import PathValues
path = PathValues.RESPONSE_BODY_POST_REF_IN_NOT_RESPONSE_BODY_FOR_CONTENT_TYPES

View File

@ -0,0 +1,228 @@
# coding: utf-8
"""
Generated by: https://openapi-generator.tech
"""
from dataclasses import dataclass
import re # noqa: F401
import sys # noqa: F401
import typing
import urllib3
import functools # noqa: F401
from urllib3._collections import HTTPHeaderDict
from unit_test_api import api_client, exceptions
import decimal # noqa: F401
from datetime import date, datetime # noqa: F401
from frozendict import frozendict # noqa: F401
from unit_test_api.schemas import ( # noqa: F401
AnyTypeSchema,
ComposedSchema,
DictSchema,
ListSchema,
StrSchema,
IntSchema,
Int32Schema,
Int64Schema,
Float32Schema,
Float64Schema,
NumberSchema,
UUIDSchema,
DateSchema,
DateTimeSchema,
DecimalSchema,
BoolSchema,
BinarySchema,
NoneSchema,
none_type,
Configuration,
Unset,
unset,
ComposedBase,
ListBase,
DictBase,
NoneBase,
StrBase,
IntBase,
Int32Base,
Int64Base,
Float32Base,
Float64Base,
NumberBase,
UUIDBase,
DateBase,
DateTimeBase,
BoolBase,
BinaryBase,
Schema,
NoneClass,
BoolClass,
_SchemaValidator,
_SchemaTypeChecker,
_SchemaEnumMaker
)
from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference
from . import path
class SchemaFor200ResponseBodyApplicationJson(
ComposedSchema
):
@classmethod
@property
@functools.cache
def _composed_schemas(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 {
'allOf': [
],
'oneOf': [
],
'anyOf': [
],
'not':
PropertyNamedRefThatIsNotAReference
}
def __new__(
cls,
*args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes],
_configuration: typing.Optional[Configuration] = None,
**kwargs: typing.Type[Schema],
) -> 'SchemaFor200ResponseBodyApplicationJson':
return super().__new__(
cls,
*args,
_configuration=_configuration,
**kwargs,
)
@dataclass
class ApiResponseFor200(api_client.ApiResponse):
response: urllib3.HTTPResponse
body: typing.Union[
SchemaFor200ResponseBodyApplicationJson,
]
headers: Unset = 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):
def _post_ref_in_not_response_body_for_content_types(
self: api_client.Api,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
"""
:param skip_deserialization: If true then api_response.response will be set but
api_response.body and api_response.headers will not be deserialized into schema
class instances
"""
used_path = path.value
_headers = HTTPHeaderDict()
# TODO add cookie handling
if accept_content_types:
for accept_content_type in accept_content_types:
_headers.add('Accept', accept_content_type)
response = self.api_client.call_api(
resource_path=used_path,
method='post'.upper(),
headers=_headers,
stream=stream,
timeout=timeout,
)
if skip_deserialization:
api_response = api_client.ApiResponseWithoutDeserialization(response=response)
else:
response_for_status = _status_code_to_response.get(str(response.status))
if response_for_status:
api_response = response_for_status.deserialize(response, self.api_client.configuration)
else:
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
def post_ref_in_not_response_body_for_content_types(
self: BaseApi,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
return self._post_ref_in_not_response_body_for_content_types(
accept_content_types=accept_content_types,
stream=stream,
timeout=timeout,
skip_deserialization=skip_deserialization
)
class ApiForpost(BaseApi):
# this class is used by api classes that refer to endpoints by path and http method names
def post(
self: BaseApi,
accept_content_types: typing.Tuple[str] = _all_accept_content_types,
stream: bool = False,
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
skip_deserialization: bool = False,
) -> typing.Union[
ApiResponseFor200,
api_client.ApiResponseWithoutDeserialization
]:
return self._post_ref_in_not_response_body_for_content_types(
accept_content_types=accept_content_types,
stream=stream,
timeout=timeout,
skip_deserialization=skip_deserialization
)