Skip to content

1.0.0 produces Schema collections as arrays instead of singular items #6

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

Open
petrosmm opened this issue May 15, 2024 · 2 comments
Open

Comments

@petrosmm
Copy link

petrosmm commented May 15, 2024

After upgrade from 0.2.1 to 1.0.0 the generator produces the Schema as array multiples instead of individual objects... My directus version is 10.11.0. Is this intentional and does the SDK respond to this? Thoughts?

image

@slyk
Copy link

slyk commented Dec 21, 2024

got same error, older version worked ok.
somebody have some fast fix?

got directus 11.2.1 so it still can get schema from it, but this [] array at the end make a mess with types :(

@slyk
Copy link

slyk commented Dec 21, 2024

Seems like its a feature, not a bug :)

117 line in index.ts: source += ${collection}: components["schemas"]["${ref}"][];\n ;

don't know what is the purpose, but that was intentional, so to use types in my project I just added [number] to extract item type from array:

export type IProductShelf =  TpsWorkDirectusTypes['product_shelf'][number];
//export type IProductShelf =  TpsWorkDirectusTypes['product_shelf']; //old code
export type IProduct2Shelf = WithRequired<TpsWorkDirectusTypes['product2shelf'][number],'shelf'>; //make some fields required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants