-
Notifications
You must be signed in to change notification settings - Fork 270
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
could not process model nullenum #185
Comments
Hi @NANASHI0X74 , so first of all, all those the last release contained a feature that models B:
type: object
properties:
language:
nullable: true
oneOf:
- $ref: '#/components/schemas/LanguageEnum'
- $ref: '#/components/schemas/BlankEnum'
- $ref: '#/components/schemas/NullEnum'
required:
- language
BlankEnum:
enum:
- ''
LanguageEnum:
enum:
- en
- es
- ru
- cn
type: string
NullEnum:
enum:
- null apparently the generator does not like the its a unfortunate situation where a "proper" schema lets the generator bail. |
@NANASHI0X74 with the latest can you test with the latest generator?
|
ok, it works with version 4.3.1. I'd tried version 4.2.2 and a snapshot of 5.0.0. |
awesome! let me know if generated client is functioning properly with regards to this |
At the moment, the dart generator doesn't support oneof properly :( |
I guess I'll try version 0.9.14 instead |
still doesn't work, but now it throws a different error: build output
|
almost works with openapitools version 4.2.2, but then there's no method Object.listFromJson :/ |
ok so first of all i would recommend using version i have noticed that this feature also made some trouble for us. it might be better to make it optional via setting. even though the schema is technically "more" correct like this, it is a meaningless win if it breaks the clients. we employ |
yeah I had the same thought that it would be handy to have a cli switch or something to switch off the null/blankenum stuff The issues and related PRs for dart are still open, so I don't think switching to a newer version will really help me, For now I think I'll just take the parts that I really need right now from the generated code and whack them into shape manually :p |
i see. makes sense. it would prob be easier just remove those parts in the schema. may be easier than editing the client. i will deal with this asap. |
please make this feature optional T_T |
@lsaavedr @NANASHI0X74 . generally, i try to make the schema as accurate as possible by default (regardless of generators). after that i try to provide options to make the client-generator usable. just as a rationale for the default ON choice. please confirm that this works as expected |
@tfranzel works flawlessly, thanks you very much!!! |
Describe the bug
I just wanted to try out generating some client code in dart against our backend, but running the openapitools generator, I get an unhelpful error:
Could not process model 'NullEnum'.Please make sure that your schema is correct!
(see end of output below). I tried a few other generators too and got the same errorTo Reproduce
manage.py spectacular > openapi-spec.yml
generator command run and output
Expected behavior
The generator generates some code or tells me what i can do to make it work 😅
Not sure if I should rather file this issue on the codegenerator or if I'm doing something wrong, but I thought maybe someone here can help me understand this exception
The text was updated successfully, but these errors were encountered: