|
|
@ -376,8 +376,7 @@ class OpenAPIBuilder implements Builder { |
|
|
|
for (final parameter in parameters) { |
|
|
|
for (final parameter in parameters) { |
|
|
|
final dartParameterNullable = _isDartParameterNullable( |
|
|
|
final dartParameterNullable = _isDartParameterNullable( |
|
|
|
parameter.required, |
|
|
|
parameter.required, |
|
|
|
parameter.schema?.nullable, |
|
|
|
parameter.schema, |
|
|
|
parameter.schema?.default_, |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
final dartParameterRequired = _isDartParameterRequired(parameter); |
|
|
|
final dartParameterRequired = _isDartParameterRequired(parameter); |
|
|
|
|
|
|
|
|
|
|
@ -484,8 +483,7 @@ class OpenAPIBuilder implements Builder { |
|
|
|
|
|
|
|
|
|
|
|
final dartParameterNullable = _isDartParameterNullable( |
|
|
|
final dartParameterNullable = _isDartParameterNullable( |
|
|
|
operation.requestBody!.required, |
|
|
|
operation.requestBody!.required, |
|
|
|
mediaType.schema?.nullable, |
|
|
|
mediaType.schema, |
|
|
|
mediaType.schema?.default_, |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
final result = resolveType( |
|
|
|
final result = resolveType( |
|
|
@ -829,10 +827,9 @@ String _toFieldName(final String dartName, final String type) => dartName == typ |
|
|
|
|
|
|
|
|
|
|
|
bool _isDartParameterNullable( |
|
|
|
bool _isDartParameterNullable( |
|
|
|
final bool? required, |
|
|
|
final bool? required, |
|
|
|
final bool? nullable, |
|
|
|
final Schema? schema, |
|
|
|
final dynamic default_, |
|
|
|
|
|
|
|
) => |
|
|
|
) => |
|
|
|
(!(required ?? false) && default_ == null) || (nullable ?? false); |
|
|
|
(!(required ?? false) && schema?.default_ == null) || (schema?.nullable ?? false); |
|
|
|
|
|
|
|
|
|
|
|
bool _isDartParameterRequired(final spec_parameter.Parameter parameter) => |
|
|
|
bool _isDartParameterRequired(final spec_parameter.Parameter parameter) => |
|
|
|
_isRequired(parameter.required, parameter.schema?.default_); |
|
|
|
_isRequired(parameter.required, parameter.schema?.default_); |
|
|
@ -983,8 +980,7 @@ TypeResult resolveObject( |
|
|
|
propertySchema, |
|
|
|
propertySchema, |
|
|
|
nullable: _isDartParameterNullable( |
|
|
|
nullable: _isDartParameterNullable( |
|
|
|
schema.required?.contains(propertyName), |
|
|
|
schema.required?.contains(propertyName), |
|
|
|
propertySchema.nullable, |
|
|
|
propertySchema, |
|
|
|
propertySchema.default_, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -1160,11 +1156,7 @@ TypeResult resolveObject( |
|
|
|
state, |
|
|
|
state, |
|
|
|
'${identifier}_${_toDartName(propertyName, uppercaseFirstCharacter: true)}', |
|
|
|
'${identifier}_${_toDartName(propertyName, uppercaseFirstCharacter: true)}', |
|
|
|
propertySchema, |
|
|
|
propertySchema, |
|
|
|
nullable: _isDartParameterNullable( |
|
|
|
nullable: _isDartParameterNullable(schema.required?.contains(propertyName), propertySchema), |
|
|
|
schema.required?.contains(propertyName), |
|
|
|
|
|
|
|
propertySchema.nullable, |
|
|
|
|
|
|
|
propertySchema.default_, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return [ |
|
|
|
return [ |
|
|
|