Emitters need concrete syntax ordering from the TypeSpec file to be available so they can maintain that order in output files.
Discussed in https://github.com/microsoft/typespec/discussions/3261
For our workload, grouping and ordering of input is important, whether in a single file or spread across multiple imported files.
As we're in the middle of a long-term migration, being able to diff manually created output against typespec-generated-output and have a rational experience is key to building confidence with our customers.
Today we're not able to replicate input ordering in output, meaning every diff is an adventure in trying to convince yourself that semantically meaningful changes haven't crept in in the transition to TypeSpec.
This is holding up our ability to migrate at scale, as the manual verification tax is so high.
@garethj-msft We were looking at this - is this specifically about a particular output, like OpenAPI3, about the order of processing each type in an emitter, or something else?
We have some solutions we have used for getting a canonical ordering in output types like OpenAPI and wonder if this might resolve your issue
@markcowl It's about being able to map TSP ordering to output format ordering primarily in our CSDL emitter.
So a canonical order doesn't much help (that's effectively what we have today - ordering by meta-type)
What we need is if the TSP author reorders model B before model A then that needs to be the order of the corresponding Entity elements in the output CSDL, regardless of semantic relationships between A and B.
@markcowl , Oh, I think you put it in a very old milestone 🦞
We have some solutions we have used for getting a canonical ordering in output types like OpenAPI and wonder if this might resolve your issue
@markcowl I ran in to same problem today. my .tsp output in openapi3 doesn't match the ordering I wrote in tsp interface. what is the solution ?