Open markosandalj opened 2 months ago
Do you have an OpenAPI JSON file to go with it?
Here is a link to google drive since Github doesn't allow uploading .yaml files https://drive.google.com/drive/folders/1CtwFX2peUVhFRpPqgDjZMqNY-5FS30b2?usp=sharing
I added it to description aswell.
This looks fetch client related right?
I don't think so, since creating a schemas containing an enum is a different process than creating a client
I don't have time to deal with this issue yet, so I'll remove the assignment to me.
Also seeing a few of these typescript errors in my generated schema. Any suggested ways to workaround it?
Update: I am working around it by re-ordering my Open API 3.0 schemas in the json
Another thought was use "mode: split" which puts all models in another file?
What are the steps to reproduce this issue?
pnpm run orval
in terminal or start development from terminal GUI inI already run that command so you can also look at the generated TS file. I added both "stripped" version of schema yaml and full one. Currently stripped one is used for generation and should be enough but if needed orval.config can be switched to use full version.
Here is a google drive link for schema files: https://drive.google.com/drive/folders/1CtwFX2peUVhFRpPqgDjZMqNY-5FS30b2?usp=sharing
What happens?
Backend is written in Django and Django rest framework so we use drf spectacular for generating open api schema. What happens is, Orval correctly generates all the types but for some reason few enums are used before they are generated. For example on line 1540:
export const SubjectRequestIcon = { ...SubjectIconEnum, ...BlankEnum, ...NullEnum } as const;
, bothBlankEnum
andNullEnum
are used but they are declared much further in the file (line ~8449 and ~5053). These two are most prevalent since they are used on every model that uses Django's choice filed and can be null in database. There are two more enums that are used before they are declared if it helps:ProductIconEnum
andLevelEnum
.What were you expecting to happen?
That enumas that are used to construct other enums are generated before them so we don't get TS errors.
Any logs, error output, etc?
There is no logs, errors or anything in CLI - everything runs fine but the generated file has typescript errors:
Block-scoped variable 'BlankEnum' used before its declaration.ts(2448)
Variable 'BlankEnum' is used before being assigned.ts(2454)
Any other comments?
I attached schema.yaml if it helps and here is orval output config:
What versions are you using?
Operating System: MacOS Package Version: 6.31.0 Browser Version: Newest Chrome