forked from loafle/openapi-generator-original
This reverts commit 057647cf1ee0793f2987e89f8a588aa3db3ceb5d.
This commit is contained in:
parent
057647cf1e
commit
c08f14500e
@ -2573,18 +2573,27 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// process 'additionalProperties'
|
// process 'additionalProperties'
|
||||||
setAddProps(schema, m);
|
if (schema.getAdditionalProperties() == null) {
|
||||||
// additionalProperties == True means that empty object will be used
|
if (disallowAdditionalPropertiesIfNotPresent) {
|
||||||
// per the openapi spec, if additionalProperties is omitted it is defaulted to empty object
|
m.isAdditionalPropertiesTrue = false;
|
||||||
// so if we do that, set isAdditionalPropertiesTrue to True
|
} else {
|
||||||
// if an explicit schema is passed in to additionalProperties, set isAdditionalPropertiesTrue to False
|
|
||||||
if (schema.getAdditionalProperties() == null && !disallowAdditionalPropertiesIfNotPresent) {
|
|
||||||
m.isAdditionalPropertiesTrue = true;
|
m.isAdditionalPropertiesTrue = true;
|
||||||
} else if (schema.getAdditionalProperties() instanceof Boolean && Boolean.TRUE.equals(schema.getAdditionalProperties())) {
|
CodegenProperty cp = fromProperty("", new Schema());
|
||||||
|
m.setAdditionalProperties(cp);
|
||||||
|
}
|
||||||
|
} else if (schema.getAdditionalProperties() instanceof Boolean) {
|
||||||
|
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
|
||||||
m.isAdditionalPropertiesTrue = true;
|
m.isAdditionalPropertiesTrue = true;
|
||||||
|
CodegenProperty cp = fromProperty("", new Schema());
|
||||||
|
m.setAdditionalProperties(cp);
|
||||||
} else {
|
} else {
|
||||||
m.isAdditionalPropertiesTrue = false;
|
m.isAdditionalPropertiesTrue = false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
m.isAdditionalPropertiesTrue = false;
|
||||||
|
CodegenProperty cp = fromProperty("", (Schema) schema.getAdditionalProperties());
|
||||||
|
m.setAdditionalProperties(cp);
|
||||||
|
}
|
||||||
|
|
||||||
// post process model properties
|
// post process model properties
|
||||||
if (m.vars != null) {
|
if (m.vars != null) {
|
||||||
@ -3028,7 +3037,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* the (String name, Schema p) arguments.
|
* the (String name, Schema p) arguments.
|
||||||
* Any subsequent processing of the CodegenModel return value must be idempotent
|
* Any subsequent processing of the CodegenModel return value must be idempotent
|
||||||
* for a given (String name, Schema schema).
|
* for a given (String name, Schema schema).
|
||||||
* Pass in null for the name to not use the schemaCodegenPropertyCache
|
|
||||||
*
|
*
|
||||||
* @param name name of the property
|
* @param name name of the property
|
||||||
* @param p OAS property schema
|
* @param p OAS property schema
|
||||||
@ -3040,17 +3048,12 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
LOGGER.debug("debugging fromProperty for " + name + " : " + p);
|
LOGGER.debug("debugging fromProperty for " + name + " : " + p);
|
||||||
boolean nullName = (name == null);
|
|
||||||
NamedSchema ns = new NamedSchema(name, p);
|
NamedSchema ns = new NamedSchema(name, p);
|
||||||
if (!nullName) {
|
|
||||||
CodegenProperty cpc = schemaCodegenPropertyCache.get(ns);
|
CodegenProperty cpc = schemaCodegenPropertyCache.get(ns);
|
||||||
if (cpc != null) {
|
if (cpc != null) {
|
||||||
LOGGER.debug("Cached fromProperty for " + name + " : " + p.getName());
|
LOGGER.debug("Cached fromProperty for " + name + " : " + p.getName());
|
||||||
return cpc;
|
return cpc;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
name = "";
|
|
||||||
}
|
|
||||||
// unalias schema
|
// unalias schema
|
||||||
p = unaliasSchema(p, importMapping);
|
p = unaliasSchema(p, importMapping);
|
||||||
|
|
||||||
@ -3373,9 +3376,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
addVarsRequiredVarsAdditionaProps(p, property);
|
addVarsRequiredVarsAdditionaProps(p, property);
|
||||||
LOGGER.debug("debugging from property return: " + property);
|
LOGGER.debug("debugging from property return: " + property);
|
||||||
if (!nullName) {
|
|
||||||
schemaCodegenPropertyCache.put(ns, property);
|
schemaCodegenPropertyCache.put(ns, property);
|
||||||
}
|
|
||||||
return property;
|
return property;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6161,25 +6162,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
return codegenParameter;
|
return codegenParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){
|
|
||||||
Schema usedSchema = new Schema();
|
|
||||||
if (schema.getAdditionalProperties() == null) {
|
|
||||||
if (!disallowAdditionalPropertiesIfNotPresent) {
|
|
||||||
CodegenProperty cp = fromProperty(null, usedSchema);
|
|
||||||
property.setAdditionalProperties(cp);
|
|
||||||
}
|
|
||||||
} else if (schema.getAdditionalProperties() instanceof Boolean) {
|
|
||||||
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
|
|
||||||
CodegenProperty cp = fromProperty(null, usedSchema);
|
|
||||||
property.setAdditionalProperties(cp);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
usedSchema = (Schema) schema.getAdditionalProperties();
|
|
||||||
CodegenProperty cp = fromProperty(null, usedSchema);
|
|
||||||
property.setAdditionalProperties(cp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addVarsRequiredVarsAdditionaProps(Schema schema, IJsonSchemaValidationProperties property){
|
private void addVarsRequiredVarsAdditionaProps(Schema schema, IJsonSchemaValidationProperties property){
|
||||||
if (!"object".equals(schema.getType())) {
|
if (!"object".equals(schema.getType())) {
|
||||||
return;
|
return;
|
||||||
@ -6196,7 +6178,20 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
.filter(p -> Boolean.TRUE.equals(p.required)).collect(Collectors.toList());
|
.filter(p -> Boolean.TRUE.equals(p.required)).collect(Collectors.toList());
|
||||||
property.setRequiredVars(requireCpVars);
|
property.setRequiredVars(requireCpVars);
|
||||||
}
|
}
|
||||||
setAddProps(schema, property);
|
if (schema.getAdditionalProperties() == null) {
|
||||||
|
if (!disallowAdditionalPropertiesIfNotPresent) {
|
||||||
|
CodegenProperty cp = fromProperty("", new Schema());
|
||||||
|
property.setAdditionalProperties(cp);
|
||||||
|
}
|
||||||
|
} else if (schema.getAdditionalProperties() instanceof Boolean) {
|
||||||
|
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
|
||||||
|
CodegenProperty cp = fromProperty("", new Schema());
|
||||||
|
property.setAdditionalProperties(cp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CodegenProperty cp = fromProperty("", (Schema) schema.getAdditionalProperties());
|
||||||
|
property.setAdditionalProperties(cp);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,22 +33,6 @@ export interface EnumArrays {
|
|||||||
arrayEnum?: Array<EnumArraysArrayEnumEnum>;
|
arrayEnum?: Array<EnumArraysArrayEnumEnum>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum EnumArraysJustSymbolEnum {
|
|
||||||
GreaterThanOrEqualTo = '>=',
|
|
||||||
Dollar = '$'
|
|
||||||
}/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum EnumArraysArrayEnumEnum {
|
|
||||||
Fish = 'fish',
|
|
||||||
Crab = 'crab'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function EnumArraysFromJSON(json: any): EnumArrays {
|
export function EnumArraysFromJSON(json: any): EnumArrays {
|
||||||
return EnumArraysFromJSONTyped(json, false);
|
return EnumArraysFromJSONTyped(json, false);
|
||||||
}
|
}
|
||||||
@ -78,4 +62,21 @@ export function EnumArraysToJSON(value?: EnumArrays | null): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum EnumArraysJustSymbolEnum {
|
||||||
|
GreaterThanOrEqualTo = '>=',
|
||||||
|
Dollar = '$'
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum EnumArraysArrayEnumEnum {
|
||||||
|
Fish = 'fish',
|
||||||
|
Crab = 'crab'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,38 +88,6 @@ export interface EnumTest {
|
|||||||
outerEnumIntegerDefaultValue?: OuterEnumIntegerDefaultValue;
|
outerEnumIntegerDefaultValue?: OuterEnumIntegerDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum EnumTestEnumStringEnum {
|
|
||||||
Upper = 'UPPER',
|
|
||||||
Lower = 'lower',
|
|
||||||
Empty = ''
|
|
||||||
}/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum EnumTestEnumStringRequiredEnum {
|
|
||||||
Upper = 'UPPER',
|
|
||||||
Lower = 'lower',
|
|
||||||
Empty = ''
|
|
||||||
}/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum EnumTestEnumIntegerEnum {
|
|
||||||
NUMBER_1 = 1,
|
|
||||||
NUMBER_MINUS_1 = -1
|
|
||||||
}/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum EnumTestEnumNumberEnum {
|
|
||||||
NUMBER_1_DOT_1 = 1.1,
|
|
||||||
NUMBER_MINUS_1_DOT_2 = -1.2
|
|
||||||
}
|
|
||||||
|
|
||||||
export function EnumTestFromJSON(json: any): EnumTest {
|
export function EnumTestFromJSON(json: any): EnumTest {
|
||||||
return EnumTestFromJSONTyped(json, false);
|
return EnumTestFromJSONTyped(json, false);
|
||||||
}
|
}
|
||||||
@ -161,4 +129,39 @@ export function EnumTestToJSON(value?: EnumTest | null): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum EnumTestEnumStringEnum {
|
||||||
|
Upper = 'UPPER',
|
||||||
|
Lower = 'lower',
|
||||||
|
Empty = ''
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum EnumTestEnumStringRequiredEnum {
|
||||||
|
Upper = 'UPPER',
|
||||||
|
Lower = 'lower',
|
||||||
|
Empty = ''
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum EnumTestEnumIntegerEnum {
|
||||||
|
NUMBER_1 = 1,
|
||||||
|
NUMBER_MINUS_1 = -1
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum EnumTestEnumNumberEnum {
|
||||||
|
NUMBER_1_DOT_1 = 1.1,
|
||||||
|
NUMBER_MINUS_1_DOT_2 = -1.2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,23 +33,6 @@ export interface InlineObject2 {
|
|||||||
enumFormString?: InlineObject2EnumFormStringEnum;
|
enumFormString?: InlineObject2EnumFormStringEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum InlineObject2EnumFormStringArrayEnum {
|
|
||||||
GreaterThan = '>',
|
|
||||||
Dollar = '$'
|
|
||||||
}/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum InlineObject2EnumFormStringEnum {
|
|
||||||
Abc = '_abc',
|
|
||||||
Efg = '-efg',
|
|
||||||
Xyz = '(xyz)'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function InlineObject2FromJSON(json: any): InlineObject2 {
|
export function InlineObject2FromJSON(json: any): InlineObject2 {
|
||||||
return InlineObject2FromJSONTyped(json, false);
|
return InlineObject2FromJSONTyped(json, false);
|
||||||
}
|
}
|
||||||
@ -79,4 +62,22 @@ export function InlineObject2ToJSON(value?: InlineObject2 | null): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum InlineObject2EnumFormStringArrayEnum {
|
||||||
|
GreaterThan = '>',
|
||||||
|
Dollar = '$'
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum InlineObject2EnumFormStringEnum {
|
||||||
|
Abc = '_abc',
|
||||||
|
Efg = '-efg',
|
||||||
|
Xyz = '(xyz)'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,15 +45,6 @@ export interface MapTest {
|
|||||||
indirectMap?: { [key: string]: boolean; };
|
indirectMap?: { [key: string]: boolean; };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum MapTestMapOfEnumStringEnum {
|
|
||||||
Upper = 'UPPER',
|
|
||||||
Lower = 'lower'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function MapTestFromJSON(json: any): MapTest {
|
export function MapTestFromJSON(json: any): MapTest {
|
||||||
return MapTestFromJSONTyped(json, false);
|
return MapTestFromJSONTyped(json, false);
|
||||||
}
|
}
|
||||||
@ -87,4 +78,13 @@ export function MapTestToJSON(value?: MapTest | null): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum MapTestMapOfEnumStringEnum {
|
||||||
|
Upper = 'UPPER',
|
||||||
|
Lower = 'lower'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,16 +57,6 @@ export interface Order {
|
|||||||
complete?: boolean;
|
complete?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum OrderStatusEnum {
|
|
||||||
Placed = 'placed',
|
|
||||||
Approved = 'approved',
|
|
||||||
Delivered = 'delivered'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function OrderFromJSON(json: any): Order {
|
export function OrderFromJSON(json: any): Order {
|
||||||
return OrderFromJSONTyped(json, false);
|
return OrderFromJSONTyped(json, false);
|
||||||
}
|
}
|
||||||
@ -104,4 +94,14 @@ export function OrderToJSON(value?: Order | null): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum OrderStatusEnum {
|
||||||
|
Placed = 'placed',
|
||||||
|
Approved = 'approved',
|
||||||
|
Delivered = 'delivered'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,16 +68,6 @@ export interface Pet {
|
|||||||
status?: PetStatusEnum;
|
status?: PetStatusEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum PetStatusEnum {
|
|
||||||
Available = 'available',
|
|
||||||
Pending = 'pending',
|
|
||||||
Sold = 'sold'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function PetFromJSON(json: any): Pet {
|
export function PetFromJSON(json: any): Pet {
|
||||||
return PetFromJSONTyped(json, false);
|
return PetFromJSONTyped(json, false);
|
||||||
}
|
}
|
||||||
@ -115,4 +105,14 @@ export function PetToJSON(value?: Pet | null): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum PetStatusEnum {
|
||||||
|
Available = 'available',
|
||||||
|
Pending = 'pending',
|
||||||
|
Sold = 'sold'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,24 +45,6 @@ export interface InlineObject {
|
|||||||
nullableNumberEnum?: number | null;
|
nullableNumberEnum?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum InlineObjectStringEnumEnum {
|
|
||||||
One = 'one',
|
|
||||||
Two = 'two',
|
|
||||||
Three = 'three'
|
|
||||||
}/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum InlineObjectNumberEnumEnum {
|
|
||||||
NUMBER_1 = 1,
|
|
||||||
NUMBER_2 = 2,
|
|
||||||
NUMBER_3 = 3
|
|
||||||
}
|
|
||||||
|
|
||||||
export function InlineObjectFromJSON(json: any): InlineObject {
|
export function InlineObjectFromJSON(json: any): InlineObject {
|
||||||
return InlineObjectFromJSONTyped(json, false);
|
return InlineObjectFromJSONTyped(json, false);
|
||||||
}
|
}
|
||||||
@ -96,4 +78,23 @@ export function InlineObjectToJSON(value?: InlineObject | null): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum InlineObjectStringEnumEnum {
|
||||||
|
One = 'one',
|
||||||
|
Two = 'two',
|
||||||
|
Three = 'three'
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum InlineObjectNumberEnumEnum {
|
||||||
|
NUMBER_1 = 1,
|
||||||
|
NUMBER_2 = 2,
|
||||||
|
NUMBER_3 = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,24 +45,6 @@ export interface InlineResponse200 {
|
|||||||
nullableNumberEnum?: number | null;
|
nullableNumberEnum?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum InlineResponse200StringEnumEnum {
|
|
||||||
One = 'one',
|
|
||||||
Two = 'two',
|
|
||||||
Three = 'three'
|
|
||||||
}/**
|
|
||||||
* @export
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
export enum InlineResponse200NumberEnumEnum {
|
|
||||||
NUMBER_1 = 1,
|
|
||||||
NUMBER_2 = 2,
|
|
||||||
NUMBER_3 = 3
|
|
||||||
}
|
|
||||||
|
|
||||||
export function InlineResponse200FromJSON(json: any): InlineResponse200 {
|
export function InlineResponse200FromJSON(json: any): InlineResponse200 {
|
||||||
return InlineResponse200FromJSONTyped(json, false);
|
return InlineResponse200FromJSONTyped(json, false);
|
||||||
}
|
}
|
||||||
@ -96,4 +78,23 @@ export function InlineResponse200ToJSON(value?: InlineResponse200 | null): any {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum InlineResponse200StringEnumEnum {
|
||||||
|
One = 'one',
|
||||||
|
Two = 'two',
|
||||||
|
Three = 'three'
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
export enum InlineResponse200NumberEnumEnum {
|
||||||
|
NUMBER_1 = 1,
|
||||||
|
NUMBER_2 = 2,
|
||||||
|
NUMBER_3 = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user