Replies: 2 comments 6 replies
-
This just walks through the types in a certain order |
Beta Was this translation helpful? Give feedback.
-
yeah this will do a depth first traversal, you could traverse the types manually to get a different order. const namespace = program.getGlobalNamespaceType()
namespace.namespace
namespace.operations
namespace.models
... However even that might not get you an order like things were defined(Each types being in a different map). Order of declaration has never been something that was defined in TypeSpec(The syntax tree will be ordered but in the type graph the order is not relevant anymore). Importing other files also would affect order in which items are checked. Could you share more on what you are trying to achieve? |
Beta Was this translation helpful? Give feedback.
-
I have used the navigateTypesInNamespace and navigateProgram to traverse the types, but it seems that these functions do not maintain the order in which the types are declared in the typespec file. Is there a different API I can use or am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions