Skip to content

Add HTTP status-code marker interfaces to the Wirespec shared library#677

Open
wilmveel wants to merge 3 commits into
masterfrom
claude/awesome-newton-n65sat
Open

Add HTTP status-code marker interfaces to the Wirespec shared library#677
wilmveel wants to merge 3 commits into
masterfrom
claude/awesome-newton-n65sat

Conversation

@wilmveel

@wilmveel wilmveel commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

This introduces shared HTTP status-code marker interfaces (Response1XX, Response2XX, Response3XX, Response4XX, Response5XX) in the Wirespec runtime 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:

  1. IR Converter (IrConverter.kt):

    • Added Response1XX through Response5XX marker interfaces in the shared Wirespec namespace, each extending Wirespec.Response<T>.
    • The per-endpoint Response{prefix}XX unions remain sealed within the endpoint object, but now extend the shared Wirespec.Response{prefix}XX<T> marker instead of the endpoint-local Response<T>.
    • Response records implement the endpoint-local sealed status union (e.g. Response2XX<TodoDto>) together with their content-type union (e.g. ResponseTodoDto).
    • The endpoint's top-level Response union lists only the content-type unions as members.
  2. Generated Code (all language emitters):

    • Added the five status-code marker interfaces to the shared Wirespec output (Java, Kotlin, Scala, Python, Rust, TypeScript).
    • Endpoint status unions now reference the shared markers (e.g. sealed interface Response2XX<T> : Wirespec.Response2XX<T>).
    • Records that implement a local status union are therefore also instances of the shared Wirespec.Response{prefix}XX.

Benefits:

  • Single, shared definition of status-code grouping that any endpoint response is a subtype of.
  • Endpoint-local status unions stay sealed, so when/switch over a status class remains exhaustive.
  • Two complementary groupings preserved: status grouping via the shared markers, content-type grouping via the endpoint unions.
  • Consistent behavior across all language emitters.

Type of Change

  • Refactoring
  • Feature

Checklist

  • I have followed the contribution guidelines
  • Generated code remains dependency-free
  • All language emitters updated consistently (Java, Kotlin, Scala, Python, Rust, TypeScript)
  • Fixture tests updated to reflect new structure
  • Shared runtime compiles in Kotlin, Java and Scala (:src:integration:wirespec:build)

Breaking Changes

None. Endpoints still expose their sealed Response{prefix}XX status unions and records implement the same interfaces; the unions are now additionally subtypes of the shared Wirespec.Response{prefix}XX markers.

https://claude.ai/code/session_01VA4pcLQ7J37Wf85SqQo6z7

claude added 2 commits June 19, 2026 18:45
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
@wilmveel wilmveel changed the title Move HTTP status code marker interfaces to Wirespec shared library Add HTTP status-code marker interfaces to the Wirespec shared library Jun 19, 2026
@sonarqubecloud

Copy link
Copy Markdown

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