Skip to content

Add reflection_apps to create v1 and v1alpha apps - #460

Merged
stefanvanburen merged 1 commit into
mainfrom
svanburen/grpcreflect-apps
Nov 11, 2026
Merged

stefanvanburen merged 1 commit into
mainfrom
svanburen/grpcreflect-apps

Conversation

@stefanvanburen

Copy link
Copy Markdown
Member

Follow-up to #453 (comment): rather than one combined app (which can't be mounted at a single path), reflection_apps(*descs) / reflection_apps_sync(*descs) return the v1 and v1alpha apps as a plain tuple, so mounting both is a one-liner loop over Mount(app.path, app). The README example now uses it.

The helpers only take descriptors; anyone needing interceptors or custom codecs can still construct the classes directly. A plain tuple rather than a NamedTuple keeps the API surface small, and upgrading to one later wouldn't break unpacking or indexing.

Both reflection services list each other in `list_services`, so a
server needs to mount both, which took four constructors. The two
service paths share no prefix, so a single combined application can't be
mounted at one `path`; instead, `reflection_apps` returns the v1 and
v1alpha ASGI applications for the same descriptors, and
`reflection_apps_sync` does the same for WSGI.

Follows up on review feedback in #453.

Signed-off-by: Stefan VanBuren <stefan@vanburen.xyz>
@stefanvanburen
stefanvanburen marked this pull request as ready for review November 10, 2026 23:14
@stefanvanburen
stefanvanburen requested a review from a team November 11, 2026 00:46
Comment on lines +35 to +38
`reflection_apps` returns applications for both `grpc.reflection.v1` and
`grpc.reflection.v1alpha`. Mount both: each lists the other, and a client
that calls v1alpha gets a 404 if it isn't mounted. Use
`reflection_apps_sync` for WSGI.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
`reflection_apps` returns applications for both `grpc.reflection.v1` and
`grpc.reflection.v1alpha`. Mount both: each lists the other, and a client
that calls v1alpha gets a 404 if it isn't mounted. Use
`reflection_apps_sync` for WSGI.
`reflection_apps` / `reflection_apps_sync` return applications for both `grpc.reflection.v1` and
`grpc.reflection.v1alpha`. It is recommended to mount both - even if mounting one, both will be returned in `ListServices` and a client that calls the unmounted service will 404.

Mostly to clarify what lists the other means here which isn't clear. Let's apply the same to the docstrings

@stefanvanburen
stefanvanburen merged commit 594cc69 into main Nov 11, 2026
26 checks passed
@stefanvanburen
stefanvanburen deleted the svanburen/grpcreflect-apps branch November 11, 2026 12:50
@anuraaga

Copy link
Copy Markdown
Collaborator

@stefanvanburen I think you missed the nit comment

#460 (review)

stefanvanburen added a commit that referenced this pull request Nov 12, 2026
Signed-off-by: Stefan VanBuren <stefan@vanburen.xyz>
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.

2 participants