Bug Report Checklist
Description
Model property with additionalProperties: {...} but without type: object producing BuildMap with a single type parameter rather than two, so the code does not compile:
Actual:
BuiltMap<String>? get mapField;
Expected (with explicit type: object):
BuiltMap<String, String>? get mapField;
openapi-generator version
7.21.0. I don't know if it's a regression, I just noticed it wasn't working.
OpenAPI declaration file content or url
openapi: 3.1.0
info:
version: 0.0.0
title: Dart bug
components:
schemas:
InvalidMap:
properties:
mapField:
#type: object
additionalProperties:
type: string
Generation Details
java -jar openapi-generator-cli-7.21.0.jar generate -g dart-dio -o out -i api.yaml
Steps to reproduce
See spec and generation details above.
Related issues/PRs
Suggest a fix
The problem appears to be that variable_type.mustache uses {{baseType}} and {{isMap}} (code). baseType appears to be derived from DefaultCodegen.getPrimitiveType, which returns "map", but isMap appears to be derived from IJsonSchemaValidationProperties.setTypeProperties, which goes down the isAnyType before isMapSchema (code). Adjusting the order in setTypeProperties to be consistent with getPrimitiveType probably fixes the problem.
Bug Report Checklist
Description
Model property with
additionalProperties: {...}but withouttype: objectproducingBuildMapwith a single type parameter rather than two, so the code does not compile:Actual:
Expected (with explicit
type: object):openapi-generator version
7.21.0. I don't know if it's a regression, I just noticed it wasn't working.
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
See spec and generation details above.
Related issues/PRs
Suggest a fix
The problem appears to be that
variable_type.mustacheuses{{baseType}}and{{isMap}}(code).baseTypeappears to be derived fromDefaultCodegen.getPrimitiveType, which returns"map", butisMapappears to be derived fromIJsonSchemaValidationProperties.setTypeProperties, which goes down theisAnyTypebeforeisMapSchema(code). Adjusting the order insetTypePropertiesto be consistent withgetPrimitiveTypeprobably fixes the problem.