-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Generate wrong swagger when use union type #880
Comments
https://json-schema.org/understanding-json-schema/reference/const It is a spec of JSON schema of very wrong time ago Also, OpenApi 3.1 supports it. |
I am encountering issues with this currently. they both generates Types that looks like this export type FilteredUserDTOOrderBy = unknown | unknown;
// i also got this on other libs
export type FilteredUserDTOOrderBy = void | void; instead of export type FilteredUserDTOOrderBy = 'id' | 'email' ; Idk if something can be done on your end. Maybe a setting toggle for the enum syntax instead of const? |
@loucass003 I use this lib https://github.com/hey-api/openapi-ts and it generate ts correctly |
Good to know, sadly for me i would like to use tenstask query with solijds. there is tenstack query generators for react but only one for solid and they use an openapi lib that is not parsing those unions correctly 😭 i can understand how this is none of netia business but this greadly reduce compatibility with other libs that havent implemented that syntax. If it is decided that nestia wont move from the const syntax i will forward this issue to the other openapi generator libs |
https://github.com/samchon/openapi @honguyenhaituan @loucass003 I think both of you want OpenAPI v3.0 document. You can convert to it manually through above library. Also, how do you think about providing OpenAPI version specification option in the import { INestiaConfig } from "@nestia/sdk";
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./src/AppModule";
export const NESTIA_CONFIG: INestiaConfig = {
input: () => NestFactory.create(AppModule),
swagger: {
openapi: "3.0", // "2.0" | "3.0" | "3.1"
output: "packages/api/swagger.json",
beautify: true,
},
};
export default NESTIA_CONFIG; |
oh wow ok. problem solved then. thank you very much @samchon again for this amazing tool that you provide <3 |
Close #880: support multiple openapi versions' generation.
Upgrade to |
Summary
Generate wrong swagger when use union type
I have a query dto like below:
but when I generate swagger what I receive is
and I found nothing about key word "const" in Open API document https://swagger.io/specification/.
In nestia version 2.6.4, I receive enum instead oneOf
The text was updated successfully, but these errors were encountered: