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

Fix issue with operation parameter versioning #2691

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

tjprescott
Copy link
Member

@tjprescott tjprescott commented Nov 22, 2023

Fixes #2688.

Copy link
Contributor

Changes in this PR will be published to the following url to try(check status of TypeSpec Pull Request Try It pipeline for publish status):
Playground: https://cadlplayground.z22.web.core.windows.net/prs/2691/

Website: https://tspwebsitepr.z22.web.core.windows.net/prs/2691/

Comment on lines -536 to -552
if (paramAvailability !== undefined) {
validateAvailabilityForContains(
program,
operationAvailability,
paramAvailability,
operation,
parameter
);
} else if (paramTypeAvailability !== undefined) {
validateAvailabilityForRef(
program,
operationAvailability,
paramTypeAvailability,
operation,
parameter.type
);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this to work, I would actually need to build the availability map based on ALL references in the spec, which would be considerably more design and implementation effort. The new test showcases the problem. Thus, I've just removed this check.

Comment on lines +930 to +938
@added(Versions.v2)
age: Foo;
}

@added(Versions.v1)
op oldOp(...Parameters): void;

@added(Versions.v3)
op newOp(...Parameters): void;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the crux of issue #2688. While this appears to be an error just looking at Parameters and newOp, it makes sense when you consider the existence of oldOp.

Copy link
Member

@timotheeguerin timotheeguerin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but Maybe good to verify the build completely fix the spec repo validation before merging

@tjprescott tjprescott merged commit b3075f0 into microsoft:main Nov 22, 2023
10 checks passed
@tjprescott tjprescott deleted the versioning/OpParams branch November 22, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"incompatible versioned reference" in function signature
2 participants