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

questions about versioning mutator #6198

Closed
tadelesh opened this issue Feb 28, 2025 · 6 comments
Closed

questions about versioning mutator #6198

tadelesh opened this issue Feb 28, 2025 · 6 comments
Assignees

Comments

@tadelesh
Copy link
Member

if an interface is deleted from a version, when i call mutateSubgraph with this version's mutator for this interface, what should i get? current behavior seems that i could get this interface, but with previous projection, i will get Intrinsic type. is it by design or a bug?

@timotheeguerin
Copy link
Member

timotheeguerin commented Feb 28, 2025

hhm I guess I didn't expect you to use the mutator that way. In theory the mutator should have removed all reference to this interface vs with projection it would convert it to never and that would remove it.

You have to be careful when using mutateSubgraph as it does partial mutation(by design or everytime you'd do you'd be mutating the entire graph, this means things like namespace will not point to the new realm but the original, types that are not mutated as well will be the original and their parent will point back to the original). This means that for versioning you do want a full mutation and should just call mutateSubgraphWithNamespace on the service namespac to mutate everything

@tadelesh
Copy link
Member Author

tadelesh commented Mar 3, 2025

for this example, how could i know BarClient is not existed in v1? from your suggestion, it seems i should call mutateSubgraphWithNamespace for root namespace, then i should iterate all the interface for the copied type graph to see if it has @client decorator. is that correct? to me, it is not very easy to use for versioning. if an operation is added in one version, and removed in another version, how can i track it?

@timotheeguerin
Copy link
Member

it wouldn't be in the containing namespace. THe way you are meant to use versioning projection or mutator is to do a full projection/mutation and just look at the projected/mutated data structure. You don't project/mutate go back and forth.

@tadelesh
Copy link
Member Author

tadelesh commented Mar 4, 2025

after i use mutateSubgraphWithNamespace , how can i know if a type has been mutated or not? can i get the original info from the result? for previous projection, i could easily know each types' projection, but for now, i have no way to know if a type has been mutated.

@timotheeguerin
Copy link
Member

timotheeguerin commented Mar 4, 2025

Everything referenced there will be mutated expect the compiler types.

The expected behavior is the first thing you do is mutate for the version you care about, then you traverse the graph returned(lose any reference to the original for that version) look at openapi or autorest implementation

We are about to remove projection this month, probably this or next month or week, this is a hard requirement for 1.0-rc, please get this solved asap. I will remove Tcgc from the build if needs be.

@timotheeguerin
Copy link
Member

talked with @iscai-msft which I think we found a way to move forward. I'll file a separate issue to discuss expanding the versioning api so you can get reference of types mutated which can allow for a bigger picture representation. But this is something that would be potentially quite prone to misuse so we'll have to be careful.
#6248

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

No branches or pull requests

2 participants