|
|
@ -652,19 +652,20 @@ class OpenAPIBuilder implements Builder { |
|
|
|
); |
|
|
|
); |
|
|
|
switch (mimeType) { |
|
|
|
switch (mimeType) { |
|
|
|
case 'application/json': |
|
|
|
case 'application/json': |
|
|
|
|
|
|
|
final nullable = _isParameterNullable( |
|
|
|
|
|
|
|
operation.requestBody!.required, |
|
|
|
|
|
|
|
mediaType.schema?.default_, |
|
|
|
|
|
|
|
); |
|
|
|
b.optionalParameters.add( |
|
|
|
b.optionalParameters.add( |
|
|
|
Parameter( |
|
|
|
Parameter( |
|
|
|
(final b) => b |
|
|
|
(final b) => b |
|
|
|
..name = _toDartName(result.name) |
|
|
|
..name = _toDartName(result.name) |
|
|
|
..type = refer(result.name) |
|
|
|
..type = refer(_makeNullable(result.name, nullable)) |
|
|
|
..named = true |
|
|
|
..named = true |
|
|
|
..required = operation.requestBody!.required ?? false, |
|
|
|
..required = operation.requestBody!.required ?? false, |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
final nullable = _isParameterNullable( |
|
|
|
|
|
|
|
operation.requestBody!.required, |
|
|
|
|
|
|
|
mediaType.schema?.default_, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (nullable) { |
|
|
|
if (nullable) { |
|
|
|
code.write('if (${_toDartName(result.name)} != null) {'); |
|
|
|
code.write('if (${_toDartName(result.name)} != null) {'); |
|
|
|
} |
|
|
|
} |
|
|
|