OpenAPITools / OpenAPITools/openapi-generator

Map<String, String> generation failed

Open
#20,813 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

We are using your tool and having problems parsing a Map<String, String> into dart. It seems it is some kind of string formatting error where > and < are not correctly translated. We assumed the bug could be around here:

https://github.com/OpenAPITools/openapi-generator/blob/123119c07614b8dcda63224b2cedcae52c069685/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/serializers.mustache#L32

Maybe it has something to do with the mustache definition here (https://mustache.github.io/mustache.5.html):

Template:

  • {{name}}
  • {{age}}
  • {{company}}
  • {{{company}}}
    Hash:
    {
    "name": "Chris",
    "company": "GitHub"
    }
    Output:
  • Chris
  • <b>GitHub</b>
  • GitHub

How we found it after api generation was this:

Image

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 with modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/serializers.mustache at the referenced line, then inspect the generated Dart serialization for a Map<String, String>. Compare the template's escaping behavior with the Mustache documentation and reproduce the reported output. Done means generated Dart preserves the angle brackets and parses the map correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.