-
Notifications
You must be signed in to change notification settings - Fork 251
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
Aliases should be kept as open api schemas #3445
Comments
Alias are by design in the TypeSpec type graph non existent so it is not possible to retrieve their name. If you want to create a union declaration you can use the union keyword or an union DateUnit {
"hours",
"days",
"weeks",
"months",
"years",
}
enum DateUnitEnum {
hours,
days,
weeks,
months,
years,
}
|
This was an issue on my part.. Also, I saw that the results of circular dependencies do not play nice with the API spec emitter. model MeuItem {
label: string;
// additional item props
}
model MenuGroup {
label: string;
// additional group props
children: MenuItem | MenuGroup;
} Is this a bug or is there another way to handle these cases?
Edit: sorry for the late response. |
Sorry never got back to you, yeah this looks like a bug in openapi3 emitter, json schema one seems to handle that correctly |
Created a new issue specially for that #3811 |
Clear and concise description of the problem
I feel like, this is almost a bug and not a feature request.
For a tsp declaration like this
we get this open API spec
As you can see we lost a piece of information about the alias.
This could have easily resulted in the following:
If the alias were to reference to models it could result into something like this:
(If an alias is not pure models or scalars we can unpack them just like now.)
And with a result like this, a client generator can easily create a type for it or even a validator.
Or am I missing something in the docs and there is an option/flag for this?
Checklist
The text was updated successfully, but these errors were encountered: