Skip to content

Try-it: send requests in their declared shape, plus conveniences - #5

Merged
hlib-zinchenko merged 2 commits into
mainfrom
feature/tryit-request-shapes
Nov 7, 2026
Merged

hlib-zinchenko merged 2 commits into
mainfrom
feature/tryit-request-shapes

Conversation

@hlib-zinchenko

Copy link
Copy Markdown
Owner

Rounds out the try-it console in Hlibz.Redoc.AspNetCore, and makes the shared sample exercise everything it can send.

Requests that went out wrong

  • Parameter styles: parameters are serialized by their declared style/explode — label and matrix in the path; spaceDelimited, pipeDelimited and deepObject in the query. An object parameter is typed as JSON and refused before sending if it isn't.
  • Accept: a select when the 2XX responses offer more than one media type. Left off with only one, so an error documented in another type can't earn a 406.
  • Whole-file bodies: a format: binary schema, or a non-text media type with no schema, gets one file picker and sends the File itself. A wildcard type like image/* takes the file's own Content-Type.
  • Server variables: each {variable} gets a field, or a select for an enum, starting at its default.

Conveniences

  • Extra headers, applied last so they can override the panel's own.
  • Variant picker for oneOf/anyOf bodies (ASP.NET Core's [JsonDerivedType]), with the discriminator first, because System.Text.Json reads it from the first property only.
  • Warn-only checks on parameter values: type, enum, length, pattern, range, item count and a few formats. They never block Send.
  • Deprecation note for deprecated operations, and a tag on deprecated parameters.
  • Copy as fetch beside Copy as cURL.

Sample and tests

Sample.Shared gains one widget operation per feature: search, compare, export (API key), datasheet (Basic), availability (server variable), promotions (polymorphic) and a deprecated lookup. GET /widgets/{id} now sends an ETag. The browser tests drive these same operations instead of test-only copies; only the redirect case is still test-only.

Testing

  • All five suites pass locally: core 28, RedocAspNetCore 38, Swashbuckle 38, host 161, browser 16.
  • Each new field checked by eye in Sample.Own. That check caught three things the tests didn't: warnings drawn as solid bars because of a class-name clash, action buttons breaking their labels in a narrow panel, and a default promotion body the server rejected.
  • Not covered by the sample: cookie parameters and x-hideTryItPanel.

🤖 Generated with Claude Code

hlib-zinchenko and others added 2 commits November 7, 2026 22:11
The console now serializes parameters by their OpenAPI style and explode
(label/matrix paths; spaceDelimited, pipeDelimited and deepObject queries;
objects typed as JSON), offers an Accept select when the 2XX responses name
more than one media type, sends a binary body as the chosen file itself,
and turns server variables into fields.

Sample.Shared gains one widget operation per shape - search, compare,
export, datasheet and availability - with API-key and Basic auth beside
the bearer token, and the browser tests now drive those operations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The console gains extra request headers (sent last, so they can override
the panel's own), a variant picker for oneOf/anyOf bodies that puts the
discriminator first, warn-only checks on parameter values, a deprecation
note, and Copy as fetch beside Copy as cURL.

Sample.Shared gains a polymorphic promotions body, a deprecated lookup,
constrained search parameters and an ETag on GET /widgets/{id}, each
driven by a browser test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hlib-zinchenko
hlib-zinchenko merged commit 00692e1 into main Nov 7, 2026
1 check passed
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.

1 participant