Add HTTP status-code marker interfaces to the Wirespec shared library#677
Open
wilmveel wants to merge 3 commits into
Open
Add HTTP status-code marker interfaces to the Wirespec shared library#677wilmveel wants to merge 3 commits into
wilmveel wants to merge 3 commits into
Conversation
Move the per-endpoint status-prefix response unions into the shared
Wirespec runtime as Response1XX..Response5XX marker interfaces, each
extending Wirespec.Response<T>. Individual endpoint response records now
implement the shared Wirespec.Response{prefix}XX interface directly
instead of a locally generated union.
The endpoint-local Response sealed hierarchy keeps its content-type
unions (which already cover every response record), so exhaustiveness is
preserved while status-prefix grouping becomes a cross-endpoint shared
concept.
Regenerated emitter fixtures for kotlin, java, python, typescript, rust
and scala.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VA4pcLQ7J37Wf85SqQo6z7
Restore the per-endpoint Response{prefix}XX unions as sealed interfaces
within the endpoint object, each extending the shared
Wirespec.Response{prefix}XX marker interface. Response records implement
the endpoint-local sealed union (plus their content-type union), so the
status grouping is once again exhaustively matchable while still being a
subtype of the shared marker.
Regenerated emitter fixtures for kotlin, java, python, typescript, rust
and scala.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VA4pcLQ7J37Wf85SqQo6z7
|
This file contains hidden or 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
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.



Description
This introduces shared HTTP status-code marker interfaces (
Response1XX,Response2XX,Response3XX,Response4XX,Response5XX) in theWirespecruntime library, and ties the per-endpoint status-prefix unions to them. Status grouping becomes a cross-endpoint concept rooted in the shared library, while each endpoint keeps a sealed, exhaustively-matchable status union.Key changes:
IR Converter (
IrConverter.kt):Response1XXthroughResponse5XXmarker interfaces in the sharedWirespecnamespace, each extendingWirespec.Response<T>.Response{prefix}XXunions remain sealed within the endpoint object, but now extend the sharedWirespec.Response{prefix}XX<T>marker instead of the endpoint-localResponse<T>.Response2XX<TodoDto>) together with their content-type union (e.g.ResponseTodoDto).Responseunion lists only the content-type unions as members.Generated Code (all language emitters):
sealed interface Response2XX<T> : Wirespec.Response2XX<T>).Wirespec.Response{prefix}XX.Benefits:
when/switchover a status class remains exhaustive.Type of Change
Checklist
:src:integration:wirespec:build)Breaking Changes
None. Endpoints still expose their sealed
Response{prefix}XXstatus unions and records implement the same interfaces; the unions are now additionally subtypes of the sharedWirespec.Response{prefix}XXmarkers.https://claude.ai/code/session_01VA4pcLQ7J37Wf85SqQo6z7