Skip to content

Commit

Permalink
fix(dynamite): only allow a single contenttype for parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
  • Loading branch information
Leptopoda committed Apr 22, 2024
1 parent 7776b63 commit e7b503d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/dynamite/dynamite/lib/src/models/openapi/parameter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ abstract class Parameter implements Built<Parameter, ParameterBuilder> {
return $schema;
}

if (content != null && content!.isNotEmpty) {
if (content!.length > 1) {
print('Can not work with multiple mime types right now. Using the first supported.');
}
if (content != null) {
final mediaType = content!.entries.single;

return Schema(
(b) => b
..type = SchemaType.string
..contentMediaType = content!.entries.first.key
..contentSchema = content!.entries.first.value.schema!.toBuilder(),
..contentMediaType = mediaType.key
..contentSchema.replace(mediaType.value.schema!),
);
}

Expand Down

0 comments on commit e7b503d

Please sign in to comment.