Skip to content

Validate generated server replies with explicit status codes - #129

Open
quinnj wants to merge 1 commit into
JuliaComputing:mainfrom
quinnj:feat/explicit-server-replies
Open

quinnj wants to merge 1 commit into
JuliaComputing:mainfrom
quinnj:feat/explicit-server-replies

Conversation

@quinnj

@quinnj quinnj commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Generated server handlers can now return OpenAPI.Reply(status, body) to choose a documented status while retaining schema validation and encoding. This supports distinct typed 200/202 results, typed errors, and multiple statuses sharing one body type. Exact status takes precedence over a range and then default; undocumented statuses fail with a clear operation/status error. Plain results and raw HTTP.Response returns retain their existing behavior.

Compatibility: the shared generated-code contract advances from 3 to 4. All stored clients and servers must be regenerated, including applications that do not use Reply. The existing exact contract guard rejects mixed versions with a regeneration message.

Reply accepts final HTTP statuses 200–599 in both constructor forms. It adds no exports, dependencies, or header overrides. Generated handler comments now describe the return behavior instead of advertising a misleading union of every documented body type. A schema named Reply still works because the wrapper is referenced through OpenAPI.Reply.

Validation:

  • Full package suites pass on Julia 1.10.12, 1.12.7, and 1.13.0.
  • Live generated-client/server tests cover exact/range/default selection, schema errors, undocumented statuses, plain/raw returns, null/empty/text/binary/sequential bodies, and generated-name collisions. The focused checks also pass with JSON 1.7.1.
  • All four pinned Petstore, Discord, Stripe, and GitHub corpus cases pass; strict documentation builds pass.
  • Runtime-input Reply construction passes actual JuliaC --trim=safe compile/run on 1.12 and 1.13 with runtime code generation disabled. A separate native selector control passes exact/range/default cases. Full generated response encoding remains outside this proof: the same bounded fixture reports 153 verifier errors on unchanged main, patched plain returns, and patched explicit replies.

Hosted CI is green on the published head: minimum/current Julia, the full OpenAPI corpus, and documentation (four jobs).

Fixes #119.

Co-authored by Codex

This branch has not been deployed

No deployments
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.

Deal with different success responses

1 participant