OpenAPITools / OpenAPITools/openapi-generator

[BUG] Description

Open
#13,212 2 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

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

dart-dio generator fails on the Plaid OpenAPI spec

openapi-generator version

b1dec24ae8675e2b099bcd7b626d465fb87f26b6

OpenAPI declaration file content or url

https://raw.githubusercontent.com/plaid/plaid-openapi/master/2020-09-14.yml

Generation Details

Generating from main, using the dart-dio generator

java -jar openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
    -i ~/schemas/plaid/2020-09-14.yml \
    -g dart-dio \
    -o ~/generated_clients/openapi_plaid \
    --additional-properties=pubName=openapi_plaid
Steps to reproduce

The above generation will throw an error from a Null value in the template context. Code generation does not complete.

This is a result of null enum values, such as in AccountSubtype. Manually removing the null enum values allows the code generation to succeed.

After manually fixing the spec file to let it complet the generated code has a few bugs:

  • refs to types that have additionalProperties: true set are assigned like primitives, instead of using BuiltValue's replace() method
  • properties with the name update cause the function with the same name to be defined twice
  • date types properties are assigned their values with the BuiltValue's replace() instead of assigned like primitives
Related issues/PRs
Suggest a fix

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 documented java -jar generation command with the Plaid 2020-09-14.yml spec and the dart-dio generator. Trace the null enum failure and then inspect the generated output for additionalProperties, update-named properties, and date assignments. Done means generation completes without manual spec edits and the listed output bugs are corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.