From 469658861f0b7727474dbc8fb2f25d0b591b8a48 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 23 Mar 2023 06:50:45 +0100 Subject: [PATCH] dynamite: Only skip default values in query parameters --- packages/dynamite/lib/src/openapi_builder.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/lib/src/openapi_builder.dart index 1c605fff..f73f49d2 100644 --- a/packages/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/lib/src/openapi_builder.dart @@ -667,7 +667,7 @@ class OpenAPIBuilder implements Builder { // Objects inside the query always have to be interpreted in some way mimeType: 'application/json', ); - if (defaultValueCode != null && parameter.in_ != 'path') { + if (defaultValueCode != null && parameter.in_ == 'query') { code.write('if (${_toDartName(parameter.name)} != $defaultValueCode) {'); } switch (parameter.in_) { @@ -689,7 +689,7 @@ class OpenAPIBuilder implements Builder { default: throw Exception('Can not work with parameter in "${parameter.in_}"'); } - if (defaultValueCode != null) { + if (defaultValueCode != null && parameter.in_ == 'query') { code.write('}'); } if (nullable) {