|
|
@ -1367,7 +1367,7 @@ TypeResult resolveType( |
|
|
|
final s = schema.ofs![results.indexOf(result)]; |
|
|
|
final s = schema.ofs![results.indexOf(result)]; |
|
|
|
b |
|
|
|
b |
|
|
|
..name = fields[result.name] |
|
|
|
..name = fields[result.name] |
|
|
|
..type = refer(_makeNullable(result.name, true)) |
|
|
|
..type = refer(_makeNullable(result.name, !(schema.allOf?.contains(s) ?? false))) |
|
|
|
..modifier = FieldModifier.final$ |
|
|
|
..modifier = FieldModifier.final$ |
|
|
|
..docs.addAll(_descriptionToDocs(s.description)); |
|
|
|
..docs.addAll(_descriptionToDocs(s.description)); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -1390,7 +1390,8 @@ TypeResult resolveType( |
|
|
|
(final b) => b |
|
|
|
(final b) => b |
|
|
|
..name = fields[result.name]! |
|
|
|
..name = fields[result.name]! |
|
|
|
..toThis = true |
|
|
|
..toThis = true |
|
|
|
..named = true, |
|
|
|
..named = true |
|
|
|
|
|
|
|
..required = schema.allOf != null, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
]), |
|
|
|
]), |
|
|
@ -1409,6 +1410,14 @@ TypeResult resolveType( |
|
|
|
) |
|
|
|
) |
|
|
|
..body = Code( |
|
|
|
..body = Code( |
|
|
|
<String>[ |
|
|
|
<String>[ |
|
|
|
|
|
|
|
if (schema.allOf != null) ...[ |
|
|
|
|
|
|
|
'return ${state.prefix}$identifier(', |
|
|
|
|
|
|
|
'data,', |
|
|
|
|
|
|
|
for (final result in results) ...[ |
|
|
|
|
|
|
|
'${fields[result.name]!}: ${result.deserialize('data')},', |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
');', |
|
|
|
|
|
|
|
] else ...[ |
|
|
|
for (final result in results) ...[ |
|
|
|
for (final result in results) ...[ |
|
|
|
'${result.name}? ${fields[result.name]!};', |
|
|
|
'${result.name}? ${fields[result.name]!};', |
|
|
|
], |
|
|
|
], |
|
|
@ -1442,15 +1451,13 @@ TypeResult resolveType( |
|
|
|
if (schema.oneOf != null) ...[ |
|
|
|
if (schema.oneOf != null) ...[ |
|
|
|
"assert([${fields.values.join(',')}].where((final x) => x != null).length == 1, 'Need oneOf for \$data');", |
|
|
|
"assert([${fields.values.join(',')}].where((final x) => x != null).length == 1, 'Need oneOf for \$data');", |
|
|
|
], |
|
|
|
], |
|
|
|
if (schema.allOf != null) ...[ |
|
|
|
|
|
|
|
"assert([${fields.values.join(',')}].where((final x) => x != null).length == ${fields.length}, 'Need allOf for \$data');", |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'return ${state.prefix}$identifier(', |
|
|
|
'return ${state.prefix}$identifier(', |
|
|
|
'data,', |
|
|
|
'data,', |
|
|
|
for (final result in results) ...[ |
|
|
|
for (final result in results) ...[ |
|
|
|
'${fields[result.name]!}: ${fields[result.name]!},', |
|
|
|
'${fields[result.name]!}: ${fields[result.name]!},', |
|
|
|
], |
|
|
|
], |
|
|
|
');', |
|
|
|
');', |
|
|
|
|
|
|
|
], |
|
|
|
].join(), |
|
|
|
].join(), |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|