OpenAPITools / OpenAPITools/openapi-generator

[BUG] [Dart] Serializers generation fails when additionalProperties = true for nested classes

Open
#22,011 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

I'm generator dart code for a Flutter project.
Let's say I have a class A, which has a few fields as well as "additionalProperties: true" in the openapi yaml file.
Now I have class B, and one of its fields is an instance of A.

If this class B is present in an endpoint's request object, it will create a bug in the "_deserializeProperties" where we get: A value of type 'ClassB' can't be assigned to a variable of type 'ClassBBuilder?'.

openapi-generator version

MacOS, version 7.12.0
Dart version 3.9.0

Generation Details

Generation threw no errors or warning and completed as expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with an OpenAPI YAML schema containing nested classes where class A has additionalProperties: true and class B is used in an endpoint request object. Inspect the generated Dart serializer's _deserializeProperties and the reported ClassB/ClassBBuilder mismatch. Done means generation succeeds and the generated request serialization no longer produces that type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter, openapi
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.