-
Notifications
You must be signed in to change notification settings - Fork 226
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
[http/openapi] Use enum-driven visibility analysis APIs #5416
Open
witemple-msft
wants to merge
10
commits into
microsoft:main
Choose a base branch
from
witemple-msft:witemple-msft/http-visibility-enum
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[http/openapi] Use enum-driven visibility analysis APIs #5416
witemple-msft
wants to merge
10
commits into
microsoft:main
from
witemple-msft:witemple-msft/http-visibility-enum
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…e/parameter visibility decorator metadata.
witemple-msft
requested review from
bterlson,
markcowl,
allenjzhang and
timotheeguerin
as code owners
December 19, 2024 18:53
witemple-msft
commented
Dec 19, 2024
.chronus/changes/witemple-msft-http-visibility-enum-2024-11-19-13-8-4.md
Outdated
Show resolved
Hide resolved
All changed packages have been documented.
Show changes
|
You can try these changes here
|
…um' into witemple-msft/http-visibility-enum
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR brings the core enum-driven visibility system to parity with the existing visibility concepts and uses its new analysis methods in the HTTP and OpenAPI libraries.
Added lifecycle visibility modifiers for
Delete
andQuery
phases.Delete
applies when a resource is passed as an argument to a DELETE operation.Query
applies when a resource is passed as an argument to a GET or HEAD operation.Added lifecycle transform templates for Delete and Query.
Made the logic of applying a visibility filter a little bit more robust. It will consider the
any
constraint of the filter to be satisfied if it is missing OR if some modifier in the constraint is present. If theany
constraint is present, but empty, it will be unsatisfiable.Deprecated
getParameterVisibility
andgetReturnTypeVisibility
in favor ofgetParameterVisibilityFilter
andgetReturnTypeVisibilityFilter
which return VisibilityFilter objects instead ofstring[]
. Like the modifier analysis methods, the filter versions of these methods are infallible.getParameterVisibilityFilter
andgetReturnTypeVisibilityFilter
accept aVisibilityProvider
object that provides default visibility filters for parameters and return types if the parameter/returnType visibilities are not set explicitly. TypeSpec core exports anEmptyProvider
that always return filters with no constraints, suitable as a default. HTTP exportsHttpVisibilityProvider
, which must be used when working in HTTP, as it provides the HTTP-specific default visibility logic that determines visibility by verb.HttpVisibilityProvider
can be instantiated with either anHttpVerb
directly, in which case that exact verb will be used;HttpOperationOptions
, in which case the verbSelector will be used if present, otherwise the fallback logic will be used; or no argument in which case the fallback logic will always be used. This gives it parity withgetHttpOperation
.HTTP now marshals conversions between core visibility and HTTP
Visibility
through visibility filters instead of visibility string arrays. The HTTP Visibility concept is unchanged.Used new forms of visibility analysis APIs in openapi to detect read-only properties.
Fixed a bug in http-server-csharp that was surfaced by these changes where a visibility constraint
Visibility.Create & Visibility.Update
was provided, resulting in Visibility.None and properties being made invisible, affecting effective type calculation for anonymous models.Closes #5119
Closes #5120