-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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] oneOf dart code generation: wrong types and html-encoded code #3965
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
@nickmeinhold : any chance you have any thoughts on this? I am looking through the source, and coming up empty. |
@alevinetx you probably know more about it than I do, I haven't had to work with oneOf/anyOf yet. Stumbling around trying to be helpful - I generated libraries for the oneOf.yaml and anyOf.yaml test files and they seemed to be valid Dart - I didn't do any testing but maybe those test files could be helpful? In the spec docs the syntax is different to what you used - just wondering if there could be any issue with contents of the yaml file. I did some searching for the Hope that's helpful, if not maybe try the Slack, the core team are often responsive there. |
Hey all. I've been following this issue for a while now—the past couple of months. Unfortunately, there seems to be no solid solution for the "anyOf" issue for Dart generators (dart and dart-dio) as of yet. Tried using openapi-generator version 4.2.x and even 5.0.x. Alas, it still produce invalid code. as for dart-dio generator: For now, I'll have to avoid using 'anyOf', 'oneOf' and 'allOf' for Dart and have to write type mappings for the concerned entities. If there's anyone who has a (temporary) solution for this, I would gladly like to know. |
Is this issue still valid? |
Bug Report Checklist
Description
When using oneOf, with options for String or int, the generated dart code produces the class model with a few errors:
1: OneOf<string, integer> : where "string" should be "String", and "integer" should be "int". These are produced as expected (String or int) with other simple entries.
2: The generated code has encoded the "<>" symbols in html form
(<, >)
openapi-generator version
$ openapi-generator version
4.1.2
OpenAPI declaration file content or url
openapi: 3.0.1
Command line used for generation
openapi-generator generate -i oneof.yaml -g dart -o oneof-out3a -p browserClient=false,supportDart2=true,generateAliasAsModel=true
Steps to reproduce
1: Use the default pet store model at https://editor.swagger.io/
2: Add these 4 lines to a model's properties:
3: Generate code in the manner shown above
4: Observe lib/model/.dart code
Related issues/PRs
#3884
Suggest a fix
If I knew, I'd drop a PR :)
The text was updated successfully, but these errors were encountered: