Adds hasRequired to all Java schema classes (#8962)

* Adds getHasRequiredVars + setHasRequiredVars to IJsonSchemaValidationProperties

* CHanges to getHasRequired and setHasRequired and implements in CodegenModel

* Updates CodegenProperty

* Updates codegenparameter

* Updates codegenresponse

* Uses setHasRequired in model/prop/parameter/response

* Adds issue spec 8906

* Adds testHasRequiredInModel

* Adds testHasRequiredInProperties

* Fixes issue spec errors

* Adds sample endpoint with schemas in patch parameter

* Adds testHasRequiredInParameters

* Adds response schemas in issue spec

* Samples and docs regenerated
This commit is contained in:
Justin Black 2021-03-18 20:42:42 -07:00 committed by GitHub
parent 2367460fef
commit a925c76561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 853 additions and 6 deletions

View File

@ -154,6 +154,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
private CodegenProperty items;
private CodegenProperty additionalProperties;
private boolean isModel;
private boolean hasRequiredVars;
public String getAdditionalPropertiesType() {
return additionalPropertiesType;
@ -733,6 +734,16 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.hasVars = hasVars;
}
@Override
public boolean getHasRequired() {
return this.hasRequired;
}
@Override
public void setHasRequired(boolean hasRequired) {
this.hasRequired = hasRequired;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@ -104,6 +104,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
private Integer maxProperties;
private Integer minProperties;
public boolean isNull;
private boolean hasRequired;
public CodegenParameter copy() {
CodegenParameter output = new CodegenParameter();
@ -153,6 +154,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
output.isNull = this.isNull;
output.setAdditionalPropertiesIsAnyType(this.getAdditionalPropertiesIsAnyType());
output.setHasVars(this.hasVars);
output.setHasRequired(this.hasRequired);
if (this._enum != null) {
output._enum = new ArrayList<String>(this._enum);
@ -207,7 +209,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
@Override
public int hashCode() {
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars);
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired);
}
@Override
@ -254,6 +256,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
isNull == that.isNull &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
getExclusiveMaximum() == that.getExclusiveMaximum() &&
getExclusiveMinimum() == that.getExclusiveMinimum() &&
getUniqueItems() == that.getUniqueItems() &&
@ -372,6 +375,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
sb.append(", isNull=").append(isNull);
sb.append(", getAdditionalPropertiesIsAnyType=").append(additionalPropertiesIsAnyType);
sb.append(", getHasVars=").append(hasVars);
sb.append(", getHasRequired=").append(hasRequired);
sb.append('}');
return sb.toString();
}
@ -619,5 +623,15 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
public void setHasVars(boolean hasVars) {
this.hasVars = hasVars;
}
@Override
public boolean getHasRequired() {
return this.hasRequired;
}
@Override
public void setHasRequired(boolean hasRequired) {
this.hasRequired = hasRequired;
}
}

View File

@ -187,6 +187,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
public boolean isXmlWrapped = false;
private boolean additionalPropertiesIsAnyType;
private boolean hasVars;
private boolean hasRequired;
public String getBaseName() {
return baseName;
@ -715,6 +716,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.hasVars = hasVars;
}
@Override
public boolean getHasRequired() {
return this.hasRequired;
}
@Override
public void setHasRequired(boolean hasRequired) {
this.hasRequired = hasRequired;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenProperty{");
@ -806,6 +817,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
sb.append(", isNull=").append(isNull);
sb.append(", getAdditionalPropertiesIsAnyType=").append(getAdditionalPropertiesIsAnyType());
sb.append(", getHasVars=").append(getHasVars());
sb.append(", getHasRequired=").append(getHasRequired());
sb.append('}');
return sb.toString();
}
@ -857,6 +869,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
isNull == that.isNull &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() ==that.getHasRequired() &&
Objects.equals(openApiType, that.openApiType) &&
Objects.equals(baseName, that.baseName) &&
Objects.equals(complexType, that.complexType) &&
@ -918,6 +931,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
items, mostInnerItems, additionalProperties, vars, requiredVars,
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName,
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars);
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired);
}
}

View File

@ -81,6 +81,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
private boolean hasValidation;
private boolean additionalPropertiesIsAnyType;
private boolean hasVars;
private boolean hasRequired;
@Override
public int hashCode() {
@ -91,7 +92,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
vars, requiredVars, isNull, hasValidation,
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars);
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired);
}
@Override
@ -135,6 +136,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
is5xx == that.is5xx &&
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
getHasVars() == that.getHasVars() &&
getHasRequired() == that.getHasRequired() &&
Objects.equals(vars, that.vars) &&
Objects.equals(requiredVars, that.requiredVars) &&
Objects.equals(headers, that.headers) &&
@ -371,6 +373,16 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
this.requiredVars = requiredVars;
}
@Override
public boolean getHasRequired() {
return this.hasRequired;
}
@Override
public void setHasRequired(boolean hasRequired) {
this.hasRequired = hasRequired;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenResponse{");
@ -435,6 +447,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
sb.append(", hasValidation='").append(hasValidation);
sb.append(", getAdditionalPropertiesIsAnyType=").append(additionalPropertiesIsAnyType);
sb.append(", getHasVars=").append(hasVars);
sb.append(", getHasRequired=").append(hasRequired);
sb.append('}');
return sb.toString();
}

View File

@ -2579,6 +2579,10 @@ public class DefaultCodegen implements CodegenConfig {
}
}
if (m.requiredVars != null && m.requiredVars.size() > 0){
m.setHasRequired(true);
}
if (sortModelPropertiesByRequiredFlag) {
Comparator<CodegenProperty> comparator = new Comparator<CodegenProperty>() {
@Override
@ -6170,6 +6174,9 @@ public class DefaultCodegen implements CodegenConfig {
.stream()
.filter(p -> Boolean.TRUE.equals(p.required)).collect(Collectors.toList());
property.setRequiredVars(requireCpVars);
if (property.getRequiredVars() != null && property.getRequiredVars().size() > 0) {
property.setHasRequired(true);
}
}
setAddProps(schema, property);
}

View File

@ -105,5 +105,9 @@ public interface IJsonSchemaValidationProperties {
boolean getHasVars();
void setHasVars(boolean hasVars);
void setHasVars(boolean hasRequiredVars);
boolean getHasRequired();
void setHasRequired(boolean hasRequired);
}

View File

@ -3075,4 +3075,203 @@ public class DefaultCodegenTest {
// does not have vars because the inline schema was extracted into a component ref
assertEquals(co.responses.get(0).getHasVars(), false);
}
@Test
public void testHasRequiredInModel() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_8906.yaml");
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
codegen.setDisallowAdditionalPropertiesIfNotPresent(false);
Schema sc;
CodegenModel cm;
List<String> modelNamesWithoutRequired = Arrays.asList(
"EmptyObject",
"ObjectWithOptionalB",
"AnyTypeNoPropertiesNoRequired",
"AnyTypeHasPropertiesNoRequired",
"AnyTypeNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ObjectNoPropertiesNoRequired",
"ObjectHasPropertiesNoRequired",
"ObjectNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedNoAllofPropsNoPropertiesNoRequired",
"ComposedNoAllofPropsHasPropertiesNoRequired",
"ComposedNoAllofPropsNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofOptPropNoPropertiesNoRequired",
"ComposedHasAllofOptPropHasPropertiesNoRequired",
"ComposedHasAllofOptPropNoPropertiesHasRequired" // TODO: hasRequired should be true, fix this
);
for (String modelName : modelNamesWithoutRequired) {
sc = openAPI.getComponents().getSchemas().get(modelName);
cm = codegen.fromModel(modelName, sc);
assertEquals(cm.getHasRequired(), false);
}
List<String> modelNamesWithRequired = Arrays.asList(
"AnyTypeHasPropertiesHasRequired",
"ObjectHasPropertiesHasRequired",
"ComposedNoAllofPropsHasPropertiesHasRequired",
"ComposedHasAllofOptPropHasPropertiesHasRequired",
"ComposedHasAllofReqPropNoPropertiesNoRequired", // TODO: hasRequired should be false, fix this
"ComposedHasAllofReqPropHasPropertiesNoRequired", // TODO: hasRequired should be false, fix this
"ComposedHasAllofReqPropNoPropertiesHasRequired",
"ComposedHasAllofReqPropHasPropertiesHasRequired"
);
for (String modelName : modelNamesWithRequired) {
sc = openAPI.getComponents().getSchemas().get(modelName);
cm = codegen.fromModel(modelName, sc);
assertEquals(cm.getHasRequired(), true);
}
}
@Test
public void testHasRequiredInProperties() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_8906.yaml");
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
codegen.setDisallowAdditionalPropertiesIfNotPresent(false);
String modelName = "CodegenPropertiesModel";
Schema sc = openAPI.getComponents().getSchemas().get(modelName);
CodegenModel cm = codegen.fromModel(modelName, sc);
HashSet<String> modelNamesWithoutRequired = new HashSet(Arrays.asList(
"EmptyObject",
"ObjectWithOptionalB",
"AnyTypeNoPropertiesNoRequired",
"AnyTypeHasPropertiesNoRequired",
"AnyTypeNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"AnyTypeHasPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ObjectNoPropertiesNoRequired",
"ObjectHasPropertiesNoRequired", // Note: this is extracted into another component and is a ref
"ObjectNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedNoAllofPropsNoPropertiesNoRequired",
"ComposedNoAllofPropsHasPropertiesNoRequired",
"ComposedNoAllofPropsNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofOptPropNoPropertiesNoRequired",
"ComposedHasAllofOptPropHasPropertiesNoRequired",
"ComposedHasAllofOptPropNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ObjectHasPropertiesHasRequired", // False because this is extracted into another component and is a ref
"ComposedNoAllofPropsHasPropertiesHasRequired", // False because this is extracted into another component and is a ref
"ComposedHasAllofOptPropHasPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofReqPropNoPropertiesNoRequired",
"ComposedHasAllofReqPropHasPropertiesNoRequired",
"ComposedHasAllofReqPropNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofReqPropHasPropertiesHasRequired" // TODO: hasRequired should be true, fix this
));
HashSet<String> modelNamesWithRequired = new HashSet(Arrays.asList(
));
for (CodegenProperty var : cm.getVars()) {
boolean hasRequired = var.getHasRequired();
if (modelNamesWithoutRequired.contains(var.name)) {
assertEquals(hasRequired, false);
} else if (modelNamesWithRequired.contains(var.name)) {
assertEquals(hasRequired, true);
} else {
// All variables must be in the above sets
assertEquals(true, false);
}
}
}
@Test
public void testHasRequiredInParameters() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_8906.yaml");
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
codegen.setDisallowAdditionalPropertiesIfNotPresent(false);
String path = "/schemasInQueryParamsAndResponses";
Operation operation = openAPI.getPaths().get(path).getPost();
CodegenOperation co = codegen.fromOperation(path, "POST", operation, null);
HashSet<String> modelNamesWithoutRequired = new HashSet(Arrays.asList(
"EmptyObject",
"ObjectWithOptionalB",
"AnyTypeNoPropertiesNoRequired",
"AnyTypeHasPropertiesNoRequired",
"AnyTypeNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"AnyTypeHasPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ObjectNoPropertiesNoRequired",
"ObjectHasPropertiesNoRequired", // Note: this is extracted into another component and is a ref
"ObjectNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedNoAllofPropsNoPropertiesNoRequired",
"ComposedNoAllofPropsHasPropertiesNoRequired",
"ComposedNoAllofPropsNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofOptPropNoPropertiesNoRequired",
"ComposedHasAllofOptPropHasPropertiesNoRequired",
"ComposedHasAllofOptPropNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ObjectHasPropertiesHasRequired", // False because this is extracted into another component and is a ref
"ComposedNoAllofPropsHasPropertiesHasRequired", // False because this is extracted into another component and is a ref
"ComposedHasAllofOptPropHasPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofReqPropNoPropertiesNoRequired",
"ComposedHasAllofReqPropHasPropertiesNoRequired",
"ComposedHasAllofReqPropNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofReqPropHasPropertiesHasRequired" // TODO: hasRequired should be true, fix this
));
HashSet<String> modelNamesWithRequired = new HashSet(Arrays.asList(
));
for (CodegenParameter param : co.pathParams) {
boolean hasRequired = param.getHasRequired();
if (modelNamesWithoutRequired.contains(param.baseName)) {
assertEquals(hasRequired, false);
} else if (modelNamesWithRequired.contains(param.baseName)) {
assertEquals(hasRequired, true);
} else {
// All variables must be in the above sets
assertEquals(true, false);
}
}
}
@Test
public void testHasRequiredInResponses() {
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_8906.yaml");
final DefaultCodegen codegen = new DefaultCodegen();
codegen.setOpenAPI(openAPI);
codegen.setDisallowAdditionalPropertiesIfNotPresent(false);
String path = "/schemasInQueryParamsAndResponses";
Operation operation = openAPI.getPaths().get(path).getPost();
CodegenOperation co = codegen.fromOperation(path, "POST", operation, null);
HashSet<String> modelNamesWithoutRequired = new HashSet(Arrays.asList(
"EmptyObject",
"ObjectWithOptionalB",
"AnyTypeNoPropertiesNoRequired",
"AnyTypeHasPropertiesNoRequired",
"AnyTypeNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"AnyTypeHasPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ObjectNoPropertiesNoRequired",
"ObjectHasPropertiesNoRequired", // Note: this is extracted into another component and is a ref
"ObjectNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedNoAllofPropsNoPropertiesNoRequired",
"ComposedNoAllofPropsHasPropertiesNoRequired",
"ComposedNoAllofPropsNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofOptPropNoPropertiesNoRequired",
"ComposedHasAllofOptPropHasPropertiesNoRequired",
"ComposedHasAllofOptPropNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ObjectHasPropertiesHasRequired", // False because this is extracted into another component and is a ref
"ComposedNoAllofPropsHasPropertiesHasRequired", // False because this is extracted into another component and is a ref
"ComposedHasAllofOptPropHasPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofReqPropNoPropertiesNoRequired",
"ComposedHasAllofReqPropHasPropertiesNoRequired",
"ComposedHasAllofReqPropNoPropertiesHasRequired", // TODO: hasRequired should be true, fix this
"ComposedHasAllofReqPropHasPropertiesHasRequired" // TODO: hasRequired should be true, fix this
));
HashSet<String> modelNamesWithRequired = new HashSet(Arrays.asList(
));
for (CodegenResponse cr : co.responses) {
boolean hasRequired = cr.getHasRequired();
if (modelNamesWithoutRequired.contains(cr.message)) {
assertEquals(hasRequired, false);
} else if (modelNamesWithRequired.contains(cr.message)) {
assertEquals(hasRequired, true);
} else {
// All variables must be in the above sets
assertEquals(true, false);
}
}
}
}

View File

@ -0,0 +1,586 @@
openapi: 3.0.1
info:
title: OpenAPI Petstore
description: "for schemas with properties and required ensure correct hasVars, hasRequired, vars, and requiredVars"
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
servers:
- url: http://petstore.swagger.io:80/v2
tags: []
paths:
/schemasInQueryParamsAndResponses:
post:
operationId: schemasInQueryParams
parameters:
- name: AnyTypeNoPropertiesNoRequired
in: query
required: true
schema:
description: "NoPropertiesNoRequired"
- name: AnyTypeHasPropertiesNoRequired
in: query
required: true
schema:
properties:
a:
type: string
- name: AnyTypeNoPropertiesHasRequired
in: query
required: true
schema:
required:
- a
- name: AnyTypeHasPropertiesHasRequired
in: query
required: true
schema:
required:
- a
properties:
a:
type: string
- name: ObjectNoPropertiesNoRequired
in: query
required: true
schema:
type: object
- name: ObjectHasPropertiesNoRequired
in: query
required: true
schema:
type: object
properties:
a:
type: string
- name: ObjectNoPropertiesHasRequired
in: query
required: true
schema:
type: object
required:
- a
- name: ObjectHasPropertiesHasRequired
in: query
required: true
schema:
type: object
required:
- a
properties:
a:
type: string
- name: ComposedNoAllofPropsNoPropertiesNoRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/EmptyObject'
- name: ComposedNoAllofPropsHasPropertiesNoRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/EmptyObject'
properties:
a:
type: string
- name: ComposedNoAllofPropsNoPropertiesHasRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/EmptyObject'
required:
- a
- name: ComposedNoAllofPropsHasPropertiesHasRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/EmptyObject'
required:
- a
properties:
a:
type: string
- name: ComposedHasAllofOptPropNoPropertiesNoRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
- name: ComposedHasAllofOptPropHasPropertiesNoRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
properties:
a:
type: string
- name: ComposedHasAllofOptPropNoPropertiesHasRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
required:
- a
- name: ComposedHasAllofOptPropHasPropertiesHasRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
required:
- a
properties:
a:
type: string
- name: ComposedHasAllofReqPropNoPropertiesNoRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
- name: ComposedHasAllofReqPropHasPropertiesNoRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
properties:
a:
type: string
- name: ComposedHasAllofReqPropNoPropertiesHasRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
required:
- a
- name: ComposedHasAllofReqPropHasPropertiesHasRequired
in: query
required: true
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
required:
- a
properties:
a:
type: string
requestBody:
content:
application/json:
schema:
type: string
required: true
responses:
200:
description: AnyTypeNoPropertiesNoRequired
content:
application/json:
schema:
description: "NoPropertiesNoRequired"
201:
description: AnyTypeHasPropertiesNoRequired
content:
application/json:
schema:
properties:
a:
type: string
202:
description: AnyTypeNoPropertiesHasRequired
content:
application/json:
schema:
required:
- a
203:
description: AnyTypeHasPropertiesHasRequired
content:
application/json:
schema:
required:
- a
properties:
a:
type: string
210:
description: ObjectNoPropertiesNoRequired
content:
application/json:
schema:
type: object
211:
description: ObjectHasPropertiesNoRequired
content:
application/json:
schema:
type: object
properties:
a:
type: string
212:
description: ObjectNoPropertiesHasRequired
content:
application/json:
schema:
type: object
required:
- a
213:
description: ObjectHasPropertiesHasRequired
content:
application/json:
schema:
type: object
required:
- a
properties:
a:
type: string
220:
description: ComposedNoAllofPropsNoPropertiesNoRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/EmptyObject'
221:
description: ComposedNoAllofPropsHasPropertiesNoRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/EmptyObject'
properties:
a:
type: string
222:
description: ComposedNoAllofPropsNoPropertiesHasRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/EmptyObject'
required:
- a
223:
description: ComposedNoAllofPropsHasPropertiesHasRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/EmptyObject'
required:
- a
properties:
a:
type: string
230:
description: ComposedHasAllofOptPropNoPropertiesNoRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
231:
description: ComposedHasAllofOptPropHasPropertiesNoRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
properties:
a:
type: string
232:
description: ComposedHasAllofOptPropNoPropertiesHasRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
required:
- a
233:
description: ComposedHasAllofOptPropHasPropertiesHasRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
required:
- a
properties:
a:
type: string
240:
description: ComposedHasAllofReqPropNoPropertiesNoRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
241:
description: ComposedHasAllofReqPropHasPropertiesNoRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
properties:
a:
type: string
242:
description: ComposedHasAllofReqPropNoPropertiesHasRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
required:
- a
243:
description: ComposedHasAllofReqPropHasPropertiesHasRequired
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
required:
- a
properties:
a:
type: string
components:
schemas:
EmptyObject:
type: object
ObjectWithOptionalB:
type: object
properties:
b:
type: string
ObjectWithRequiredB:
type: object
properties:
b:
type: string
required:
- b
AnyTypeNoPropertiesNoRequired:
description: "NoPropertiesNoRequired"
AnyTypeHasPropertiesNoRequired:
properties:
a:
type: string
AnyTypeNoPropertiesHasRequired:
required:
- a
AnyTypeHasPropertiesHasRequired:
required:
- a
properties:
a:
type: string
ObjectNoPropertiesNoRequired:
type: object
ObjectHasPropertiesNoRequired:
type: object
properties:
a:
type: string
ObjectNoPropertiesHasRequired:
type: object
required:
- a
ObjectHasPropertiesHasRequired:
type: object
required:
- a
properties:
a:
type: string
ComposedNoAllofPropsNoPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/EmptyObject'
ComposedNoAllofPropsHasPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/EmptyObject'
properties:
a:
type: string
ComposedNoAllofPropsNoPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/EmptyObject'
required:
- a
ComposedNoAllofPropsHasPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/EmptyObject'
type: object
required:
- a
properties:
a:
type: string
ComposedHasAllofOptPropNoPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
ComposedHasAllofOptPropHasPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
properties:
a:
type: string
ComposedHasAllofOptPropNoPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
required:
- a
ComposedHasAllofOptPropHasPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
type: object
required:
- a
properties:
a:
type: string
ComposedHasAllofReqPropNoPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
ComposedHasAllofReqPropHasPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
properties:
a:
type: string
ComposedHasAllofReqPropNoPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
required:
- a
ComposedHasAllofReqPropHasPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
type: object
required:
- a
properties:
a:
type: string
CodegenPropertiesModel:
description: "this model lets us check CodegenProperty.vars/requiredVars/hasVars/hasRequired"
type: object
properties:
AnyTypeNoPropertiesNoRequired:
description: "NoPropertiesNoRequired"
AnyTypeHasPropertiesNoRequired:
properties:
a:
type: string
AnyTypeNoPropertiesHasRequired:
required:
- a
AnyTypeHasPropertiesHasRequired:
required:
- a
properties:
a:
type: string
ObjectNoPropertiesNoRequired:
type: object
ObjectHasPropertiesNoRequired:
type: object
properties:
a:
type: string
ObjectNoPropertiesHasRequired:
type: object
required:
- a
ObjectHasPropertiesHasRequired:
type: object
required:
- a
properties:
a:
type: string
ComposedNoAllofPropsNoPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/EmptyObject'
ComposedNoAllofPropsHasPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/EmptyObject'
properties:
a:
type: string
ComposedNoAllofPropsNoPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/EmptyObject'
required:
- a
ComposedNoAllofPropsHasPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/EmptyObject'
type: object
required:
- a
properties:
a:
type: string
ComposedHasAllofOptPropNoPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
ComposedHasAllofOptPropHasPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
properties:
a:
type: string
ComposedHasAllofOptPropNoPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
required:
- a
ComposedHasAllofOptPropHasPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithOptionalB'
type: object
required:
- a
properties:
a:
type: string
ComposedHasAllofReqPropNoPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
ComposedHasAllofReqPropHasPropertiesNoRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
properties:
a:
type: string
ComposedHasAllofReqPropNoPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
required:
- a
ComposedHasAllofReqPropHasPropertiesHasRequired:
allOf:
- $ref: '#/components/schemas/ObjectWithRequiredB'
type: object
required:
- a
properties:
a:
type: string
securitySchemes: {}

View File

@ -539,10 +539,10 @@ public interface PathHandlerInterface {
* <p><b>Response headers</b>: [CodegenProperty{openApiType='integer', baseName='X-Rate-Limit', complexType='null', getter='getxRateLimit', setter='setxRateLimit', description='calls per hour allowed by the user', dataType='Integer', datatypeWithEnum='Integer', dataFormat='int32', name='xRateLimit', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Rate-Limit;', baseType='Integer', containerType='null', title='null', unescapedDescription='calls per hour allowed by the user', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "integer",
"format" : "int32"
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isLong=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when toekn expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when toekn expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isLong=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when toekn expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when toekn expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{
"type" : "string",
"format" : "date-time"
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isLong=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false}]</p>
}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isLong=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false}]</p>
*
* <p><b>Produces</b>: [{mediaType=application/xml}, {mediaType=application/json}]</p>
* <p><b>Returns</b>: {@link String}</p>