Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [dart-dio] Enum properties with "default" values create compile errors #20495

Open
5 of 6 tasks
mrohlof-protofy opened this issue Jan 17, 2025 · 0 comments
Open
5 of 6 tasks

Comments

@mrohlof-protofy
Copy link

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

For a schema that has an Enum property with a "default" value, the generated result has compile errors. This does not happen with string properties that have default values.

Minimal api.json:

https://gist.github.com/mrohlof-protofy/f35cab420710d1ce696c28a584285099

Call:

openapi-generator generate -g dart-dio -i api.json -o ./
dart run build_runner build --delete-conflicting-outputs

Result:

...
27 |  static void _defaults(MyActionBuilder b) => b
28 |      ..executionMode = const ._(ExecutionMode.INSTANT);
...

Issue:

my_action.dart:28:31: Expected an identifier.

Expected Result:

...
27 |  static void _defaults(MyActionBuilder b) => b
28 |      ..executionMode = ExecutionMode.INSTANT;
...
openapi-generator version

7.10.0

OpenAPI declaration file content or url

Minimal example:
https://gist.github.com/mrohlof-protofy/f35cab420710d1ce696c28a584285099

Generation Details
Steps to reproduce
openapi-generator generate -g dart-dio -i api.json -o ./
dart run build_runner build --delete-conflicting-outputs
Related issues/PRs
Suggest a fix

Defaults

@mrohlof-protofy mrohlof-protofy changed the title [BUG] [dart-dio] [BUG] [dart-dio] Enum properties with "default" values create compile errors Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant