mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-18 04:59:15 +00:00
Adds dependentRequired (#13442)
* Updates codegenmodel * Updates codegenProperty * Updates codegenParameter * Updates codegenResponse * Samples regenerated
This commit is contained in:
@@ -115,6 +115,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
private boolean isBooleanSchemaTrue;
|
||||
private boolean isBooleanSchemaFalse;
|
||||
private String format;
|
||||
private LinkedHashMap<String, List<String>> dependentRequired;
|
||||
|
||||
/**
|
||||
* The type of the value for the additionalProperties keyword in the OAS document.
|
||||
@@ -180,6 +181,16 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
this.additionalPropertiesType = additionalPropertiesType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashMap<String, List<String>> getDependentRequired() {
|
||||
return dependentRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDependentRequired(LinkedHashMap<String, List<String>> dependentRequired) {
|
||||
this.dependentRequired = dependentRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsBooleanSchemaTrue() {
|
||||
return isBooleanSchemaTrue;
|
||||
@@ -892,8 +903,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
return hasDiscriminatorWithNonEmptyMapping;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public void setHasDiscriminatorWithNonEmptyMapping(boolean hasDiscriminatorWithNonEmptyMapping) {
|
||||
this.hasDiscriminatorWithNonEmptyMapping = hasDiscriminatorWithNonEmptyMapping;
|
||||
@@ -998,6 +1007,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
getUniqueItems() == that.getUniqueItems() &&
|
||||
getExclusiveMinimum() == that.getExclusiveMinimum() &&
|
||||
getExclusiveMaximum() == that.getExclusiveMaximum() &&
|
||||
Objects.equals(dependentRequired, that.getDependentRequired()) &&
|
||||
Objects.equals(format, that.getFormat()) &&
|
||||
Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
|
||||
Objects.equals(ref, that.getRef()) &&
|
||||
@@ -1076,7 +1086,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
|
||||
isAnyType, getComposedSchemas(), hasMultipleTypes, isDecimal, isUuid, requiredVarsMap, ref,
|
||||
uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
|
||||
format);
|
||||
format, dependentRequired);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1180,6 +1190,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
sb.append(", isBooleanSchemaTrue=").append(isBooleanSchemaTrue);
|
||||
sb.append(", isBooleanSchemaFalse=").append(isBooleanSchemaFalse);
|
||||
sb.append(", format=").append(format);
|
||||
sb.append(", dependentRequired=").append(dependentRequired);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -440,6 +440,16 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
// use schema.getDependentRequired or content.mediaType.schema.getDependentRequired instead of this
|
||||
@Override
|
||||
public LinkedHashMap<String, List<String>> getDependentRequired() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// use schema.setDependentRequired or content.mediaType.schema.setDependentRequired instead of this
|
||||
@Override
|
||||
public void setDependentRequired(LinkedHashMap<String, List<String>> dependentRequired) {}
|
||||
|
||||
// use schema.getIsBooleanSchemaTrue or content.mediaType.schema.getIsBooleanSchemaTrue instead of this
|
||||
@Override
|
||||
public boolean getIsBooleanSchemaTrue() {
|
||||
|
||||
@@ -201,6 +201,17 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
private boolean isBooleanSchemaTrue;
|
||||
private boolean isBooleanSchemaFalse;
|
||||
private String format;
|
||||
private LinkedHashMap<String, List<String>> dependentRequired;
|
||||
|
||||
@Override
|
||||
public LinkedHashMap<String, List<String>> getDependentRequired() {
|
||||
return dependentRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDependentRequired(LinkedHashMap<String, List<String>> dependentRequired) {
|
||||
this.dependentRequired = dependentRequired;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFormat(String format) { this.format = format; }
|
||||
@@ -752,6 +763,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
if (this.format != null) {
|
||||
cp.setFormat(this.format);
|
||||
}
|
||||
if (this.dependentRequired != null) {
|
||||
cp.setDependentRequired(this.dependentRequired);
|
||||
}
|
||||
|
||||
return cp;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
@@ -1051,6 +1065,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
sb.append(", isBooleanSchemaTrue=").append(isBooleanSchemaTrue);
|
||||
sb.append(", isBooleanSchemaFalse=").append(isBooleanSchemaFalse);
|
||||
sb.append(", format=").append(format);
|
||||
sb.append(", dependentRequired=").append(dependentRequired);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -1112,6 +1127,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() &&
|
||||
getHasVars() == that.getHasVars() &&
|
||||
getHasRequired() == that.getHasRequired() &&
|
||||
Objects.equals(dependentRequired, that.getDependentRequired()) &&
|
||||
Objects.equals(format, that.getFormat()) &&
|
||||
Objects.equals(uniqueItemsBoolean, that.getUniqueItemsBoolean()) &&
|
||||
Objects.equals(ref, that.getRef()) &&
|
||||
@@ -1181,6 +1197,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired,
|
||||
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, requiredVarsMap,
|
||||
ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
|
||||
format);
|
||||
format, dependentRequired);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,16 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
|
||||
}
|
||||
|
||||
// use content.mediaType.schema.getDependentRequired instead of this
|
||||
@Override
|
||||
public LinkedHashMap<String, List<String>> getDependentRequired() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// use content.mediaType.schema.setDependentRequired instead of this
|
||||
@Override
|
||||
public void setDependentRequired(LinkedHashMap<String, List<String>> dependentRequired) {}
|
||||
|
||||
// use content.mediaType.schema.getIsBooleanSchemaTrue instead of this
|
||||
@Override
|
||||
public boolean getIsBooleanSchemaTrue() {
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.openapitools.codegen;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -14,6 +15,10 @@ import org.openapitools.codegen.meta.features.SchemaSupportFeature;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
public interface IJsonSchemaValidationProperties {
|
||||
LinkedHashMap<String, List<String>> getDependentRequired();
|
||||
|
||||
void setDependentRequired(LinkedHashMap<String, List<String>> dependentRequired);
|
||||
|
||||
String getPattern();
|
||||
|
||||
void setPattern(String pattern);
|
||||
|
||||
Reference in New Issue
Block a user