Skip to content
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

[Bug]: Namespace seemingly has no way to get interspersed type members of different kinds in source code order #5446

Open
4 tasks done
TomerAberbach opened this issue Dec 25, 2024 · 0 comments
Labels
bug Something isn't working needs-area

Comments

@TomerAberbach
Copy link
Contributor

Describe the bug

For example, if I have:

scalar Scalar1 is extends string;

model Model1 {}

scalar Scalar2 is extends string;

model Model2 {}

Then there's seemingly no way to get an array of Type objects from the Namespace that gives me the scalars and models in the right interspersed order. I can get the scalars in order (via namespace.scalars) and the models in order (via namespace.models), but I have no way to know how the scalars and models were placed relative to each other.

The same applies to all other kinds (e.g. unions, nested namespaces, decorator declarations, etc.). Ideally I could do namespace.types and get the list of top-level types so I can emit generated code that reflects the order of types in the TypeSpec file.

Maybe there is a way and I haven't found it. If that's the case, then maybe it should be more obvious.

Reproduction

See above.

Checklist

@TomerAberbach TomerAberbach added the bug Something isn't working label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-area
Projects
None yet
Development

No branches or pull requests

1 participant