Open ricardoboss opened 4 months ago
When using a spec that defines a schema of an object containing string keys and string array values the generator produces invalid Dart code.
To reproduce, create a new flutter project and set up openapi_generator with the following spec:
openapi_generator
{ "openapi": "3.0.1", "info": { "title": "Test API", "version": "1.0" }, "paths": { "/Test": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TestDto" } } } } } } } }, "components": { "schemas": { "TestDto": { "required": [ "values" ], "type": "object", "properties": { "values": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } }, "additionalProperties": false } } } }
The generated code should be able to compile.
The code should have the following differences:
return TestDto( values: json[r'values'] == null ? const {} - : mapCastOfType<String, List>(json, r'values'), + : mapCastOfType<String, List<String>>(json, r'values') ?? {}, );
No response
macOS
5.0.2
3.16.9
stable
Description of the bug
When using a spec that defines a schema of an object containing string keys and string array values the generator produces invalid Dart code.
Steps to reproduce
To reproduce, create a new flutter project and set up
openapi_generator
with the following spec:Expected behavior
The generated code should be able to compile.
The code should have the following differences:
Logs
No response
Screenshots
Platform
macOS
Library version
5.0.2
Flutter version
3.16.9
Flutter channel
stable
Additional context
No response