|
|
@ -225,6 +225,7 @@ class OpenAPIBuilder implements Builder { |
|
|
|
final String identifier, |
|
|
|
final String identifier, |
|
|
|
final Schema schema, { |
|
|
|
final Schema schema, { |
|
|
|
final bool ignoreEnum = false, |
|
|
|
final bool ignoreEnum = false, |
|
|
|
|
|
|
|
final Map<String, String>? extraJsonSerializableValues, |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
TypeResolveResult? result; |
|
|
|
TypeResolveResult? result; |
|
|
|
if (schema.ref != null) { |
|
|
|
if (schema.ref != null) { |
|
|
@ -232,13 +233,26 @@ class OpenAPIBuilder implements Builder { |
|
|
|
result = resolveType( |
|
|
|
result = resolveType( |
|
|
|
name, |
|
|
|
name, |
|
|
|
spec.components!.schemas![name]!, |
|
|
|
spec.components!.schemas![name]!, |
|
|
|
|
|
|
|
extraJsonSerializableValues: extraJsonSerializableValues, |
|
|
|
); |
|
|
|
); |
|
|
|
} else if (schema.ofs != null) { |
|
|
|
} else if (schema.ofs != null) { |
|
|
|
if (!resolvedTypes.contains(identifier)) { |
|
|
|
if (!resolvedTypes.contains(identifier)) { |
|
|
|
resolvedTypes.add(identifier); |
|
|
|
resolvedTypes.add(identifier); |
|
|
|
|
|
|
|
|
|
|
|
final results = |
|
|
|
final results = schema.ofs! |
|
|
|
schema.ofs!.map((final s) => resolveType('$identifier${schema.ofs!.indexOf(s)}', s)).toList(); |
|
|
|
.map( |
|
|
|
|
|
|
|
(final s) => resolveType( |
|
|
|
|
|
|
|
'$identifier${schema.ofs!.indexOf(s)}', |
|
|
|
|
|
|
|
s, |
|
|
|
|
|
|
|
extraJsonSerializableValues: { |
|
|
|
|
|
|
|
'disallowUnrecognizedKeys': 'true', |
|
|
|
|
|
|
|
if (extraJsonSerializableValues != null) ...{ |
|
|
|
|
|
|
|
...extraJsonSerializableValues, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
|
|
output.add( |
|
|
|
output.add( |
|
|
|
Class( |
|
|
|
Class( |
|
|
@ -383,6 +397,7 @@ class OpenAPIBuilder implements Builder { |
|
|
|
final subResult = resolveType( |
|
|
|
final subResult = resolveType( |
|
|
|
identifier, |
|
|
|
identifier, |
|
|
|
schema.items!, |
|
|
|
schema.items!, |
|
|
|
|
|
|
|
extraJsonSerializableValues: extraJsonSerializableValues, |
|
|
|
); |
|
|
|
); |
|
|
|
result = TypeResolveResult( |
|
|
|
result = TypeResolveResult( |
|
|
|
'List<${subResult.typeName}>', |
|
|
|
'List<${subResult.typeName}>', |
|
|
@ -425,7 +440,18 @@ class OpenAPIBuilder implements Builder { |
|
|
|
'/// ${schema.description!}', |
|
|
|
'/// ${schema.description!}', |
|
|
|
], |
|
|
|
], |
|
|
|
]) |
|
|
|
]) |
|
|
|
..annotations.add(refer('JsonSerializable').call([])) |
|
|
|
..annotations.add( |
|
|
|
|
|
|
|
refer('JsonSerializable').call( |
|
|
|
|
|
|
|
[], |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (extraJsonSerializableValues != null) ...{ |
|
|
|
|
|
|
|
for (final key in extraJsonSerializableValues.keys) ...{ |
|
|
|
|
|
|
|
key: refer(extraJsonSerializableValues[key]!), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
..constructors.addAll( |
|
|
|
..constructors.addAll( |
|
|
|
[ |
|
|
|
[ |
|
|
|
Constructor( |
|
|
|
Constructor( |
|
|
@ -476,6 +502,7 @@ class OpenAPIBuilder implements Builder { |
|
|
|
uppercaseFirstCharacter: true, |
|
|
|
uppercaseFirstCharacter: true, |
|
|
|
), |
|
|
|
), |
|
|
|
schema.properties![propertyName]!, |
|
|
|
schema.properties![propertyName]!, |
|
|
|
|
|
|
|
extraJsonSerializableValues: extraJsonSerializableValues, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
final propertySchema = schema.properties![propertyName]!; |
|
|
|
final propertySchema = schema.properties![propertyName]!; |
|
|
@ -554,6 +581,7 @@ class OpenAPIBuilder implements Builder { |
|
|
|
'$identifier${_toDartName(value.toString(), uppercaseFirstCharacter: true)}', |
|
|
|
'$identifier${_toDartName(value.toString(), uppercaseFirstCharacter: true)}', |
|
|
|
schema, |
|
|
|
schema, |
|
|
|
ignoreEnum: true, |
|
|
|
ignoreEnum: true, |
|
|
|
|
|
|
|
extraJsonSerializableValues: extraJsonSerializableValues, |
|
|
|
); |
|
|
|
); |
|
|
|
b |
|
|
|
b |
|
|
|
..name = _toDartName(value.toString()) |
|
|
|
..name = _toDartName(value.toString()) |
|
|
|