Providing the useEnumExtension field to the DioProperties in the @Openapi annotation's field additionalProperties, causes the build_runner to return a type error:
type 'String' is not a subtype of type 'bool?'
It seems that convertToPropertyValue returns a string representation of the provided value (for boolean values, it converts the value to "true" or "false"). So, the map's type passed to the named constructor fromMap is Map<String, String>. In the base class's named constructor AdditionalProperties.fromMap it is expected that there is a boolean value, but there's a string representation. Boolean values should be treated in this constructor the same way as they are in the DioProperties subclass in the fromMap constructor.
Steps to reproduce
Add useEnumExtension: true to the package's example.
Expected behavior
The source generation runs successfully.
Logs
[SEVERE] openapi_generator on lib/api/gen_config.dart (cached):
- There was an error generating the spec.
type 'String' is not a subtype of type 'bool?'
package:openapi_generator_annotations/src/openapi_generator_annotations_base.dart 421:53 new AdditionalProperties.fromMap
package:openapi_generator_annotations/src/openapi_generator_annotations_base.dart 632:15 new DioAltProperties.fromMap
package:openapi_generator/src/extensions/type_methods.dart 130:33 ReadProperty.readPropertyOrDefault
package:openapi_generator/src/models/generator_arguments.dart 152:44 new GeneratorArguments
package:openapi_generator/src/openapi_generator_runner.dart 60:22 OpenapiGenerator.generateForAnnotatedElement
package:source_gen/src/generator_for_annotation.dart 53:30 GeneratorForAnnotation.generate
package:source_gen/src/builder.dart 355:33 _generate
Description of the bug
Providing the
useEnumExtension
field to theDioProperties
in the@Openapi
annotation's fieldadditionalProperties
, causes thebuild_runner
to return a type error:type 'String' is not a subtype of type 'bool?'
It seems that
convertToPropertyValue
returns a string representation of the provided value (for boolean values, it converts the value to "true" or "false"). So, the map's type passed to the named constructorfromMap
isMap<String, String>
. In the base class's named constructorAdditionalProperties.fromMap
it is expected that there is a boolean value, but there's a string representation. Boolean values should be treated in this constructor the same way as they are in theDioProperties
subclass in thefromMap
constructor.Steps to reproduce
Add
useEnumExtension: true
to the package's example.Expected behavior
The source generation runs successfully.
Logs
Screenshots
No response
Platform
macOS
Library version
4.13.0
Flutter version
3.13.2
Flutter channel
stable
Additional context
No response