|
|
@ -710,13 +710,10 @@ class OpenAPIBuilder implements Builder { |
|
|
|
|
|
|
|
|
|
|
|
output.addAll(state.output.map((final e) => e.accept(emitter).toString())); |
|
|
|
output.addAll(state.output.map((final e) => e.accept(emitter).toString())); |
|
|
|
|
|
|
|
|
|
|
|
if (state.resolvedTypeCombinations.isNotEmpty) { |
|
|
|
if (state.resolvedTypes.isNotEmpty) { |
|
|
|
output.addAll([ |
|
|
|
output.addAll([ |
|
|
|
'final Serializers _serializers = (Serializers().toBuilder()', |
|
|
|
'final Serializers _serializers = (Serializers().toBuilder()', |
|
|
|
...state.resolvedTypeCombinations |
|
|
|
...state.resolvedTypes.map((final type) => type.serializers).expand((final element) => element).toSet(), |
|
|
|
.map((final type) => type.serializers) |
|
|
|
|
|
|
|
.expand((final element) => element) |
|
|
|
|
|
|
|
.toSet(), |
|
|
|
|
|
|
|
').build();', |
|
|
|
').build();', |
|
|
|
'', |
|
|
|
'', |
|
|
|
'Serializers get ${variablePrefix}Serializers => _serializers;', |
|
|
|
'Serializers get ${variablePrefix}Serializers => _serializers;', |
|
|
@ -926,9 +923,8 @@ class State { |
|
|
|
State(this.prefix); |
|
|
|
State(this.prefix); |
|
|
|
|
|
|
|
|
|
|
|
final String prefix; |
|
|
|
final String prefix; |
|
|
|
final resolvedTypes = <String>{}; |
|
|
|
|
|
|
|
final output = <Spec>[]; |
|
|
|
final output = <Spec>[]; |
|
|
|
final resolvedTypeCombinations = <TypeResult>{}; |
|
|
|
final resolvedTypes = <TypeResult>{}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TypeResult resolveObject( |
|
|
|
TypeResult resolveObject( |
|
|
@ -940,8 +936,7 @@ TypeResult resolveObject( |
|
|
|
final bool nullable = false, |
|
|
|
final bool nullable = false, |
|
|
|
final bool isHeader = false, |
|
|
|
final bool isHeader = false, |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
if (!state.resolvedTypes.contains('${state.prefix}$identifier')) { |
|
|
|
if (state.resolvedTypes.add(TypeResultObject('${state.prefix}$identifier'))) { |
|
|
|
state.resolvedTypes.add('${state.prefix}$identifier'); |
|
|
|
|
|
|
|
state.output.add( |
|
|
|
state.output.add( |
|
|
|
Class( |
|
|
|
Class( |
|
|
|
(final b) { |
|
|
|
(final b) { |
|
|
@ -1268,8 +1263,7 @@ TypeResult resolveType( |
|
|
|
nullable: nullable, |
|
|
|
nullable: nullable, |
|
|
|
); |
|
|
|
); |
|
|
|
} else if (schema.ofs != null) { |
|
|
|
} else if (schema.ofs != null) { |
|
|
|
if (!state.resolvedTypes.contains('${state.prefix}$identifier')) { |
|
|
|
if (state.resolvedTypes.add(TypeResultObject('${state.prefix}$identifier'))) { |
|
|
|
state.resolvedTypes.add('${state.prefix}$identifier'); |
|
|
|
|
|
|
|
final results = schema.ofs! |
|
|
|
final results = schema.ofs! |
|
|
|
.map( |
|
|
|
.map( |
|
|
|
(final s) => resolveType( |
|
|
|
(final s) => resolveType( |
|
|
@ -1659,8 +1653,7 @@ TypeResult resolveType( |
|
|
|
|
|
|
|
|
|
|
|
if (result != null) { |
|
|
|
if (result != null) { |
|
|
|
if (!ignoreEnum && schema.enum_ != null) { |
|
|
|
if (!ignoreEnum && schema.enum_ != null) { |
|
|
|
if (!state.resolvedTypes.contains('${state.prefix}$identifier')) { |
|
|
|
if (state.resolvedTypes.add(TypeResultEnum('${state.prefix}$identifier', result))) { |
|
|
|
state.resolvedTypes.add('${state.prefix}$identifier'); |
|
|
|
|
|
|
|
state.output.add( |
|
|
|
state.output.add( |
|
|
|
Class( |
|
|
|
Class( |
|
|
|
(final b) => b |
|
|
|
(final b) => b |
|
|
@ -1764,7 +1757,7 @@ TypeResult resolveType( |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
state.resolvedTypeCombinations.add(result); |
|
|
|
state.resolvedTypes.add(result); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|