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.
part of openapi.api; class Pet { OneOf<string,integer> bodyText = null;
2: The generated code has encoded the "<>" symbols in html form (<, >)
if (json['bodyText'] == null) { bodyText = null; } else { bodyText = OneOf<string,integer>.fromJson(json['bodyText']);openapi-generator version
$ openapi-generator version
4.1.2
openapi: 3.0.1
Blob: required: - name type: object properties: bodyText: oneOf: - type: string - type: integerCommand line used for generation
openapi-generator generate -i oneof.yaml -g dart -o oneof-out3a -p browserClient=false,supportDart2=true,generateAliasAsModel=true
Steps to reproduce1: Use the default pet store model at https://editor.swagger.io/
2: Add these 4 lines to a model's properties:
bodyText: oneOf: - type: string - type: integer
3: Generate code in the manner shown above
4: Observe lib/model/.dart code
If I knew, I'd drop a PR :)
stephane-segning and BeliliFahem
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4