Skip to content

fix(rapidoc): show untyped annotated schemas as any and primitive oneOf options on one row - #1164

Merged
mrin9 merged 2 commits into
rapi-doc:masterfrom
PerfectMemory:fix/schema-table-any-and-primitive-options
Nov 1, 2026
Merged

mrin9 merged 2 commits into
rapi-doc:masterfrom
PerfectMemory:fix/schema-table-any-and-primitive-options

Conversation

@sroucheray

Copy link
Copy Markdown
Contributor

Summary

Two small fixes in the schema table, both seen on a real API that uses oneOf and untyped
schemas. They are independent, one commit each.

1. Untyped schemas that only carry annotations are shown as any

getTypeInfo only returned any for a completely empty schema. As soon as an untyped
schema had a description, the table rendered {missing-type-info}:

filter:
  type: array
  items:
    description: A string, a number or a boolean   # no `type`
  • Before: filter [{missing-type-info}]
  • After: filter [any]

A schema that only has annotation keywords (title, description, example, examples,
default, deprecated, readOnly, writeOnly, externalDocs, x-*) is now any.
A schema with constraints but no type (e.g. minLength: 3) still reports a missing type.

2. A primitive option of a oneOf / anyOf takes one row instead of two

A primitive option (string, number, boolean...) was rendered as the OPT n badge row,
then a second row named Option n that repeated it before the type:

OPT 1
Option 1      string
OPT 2
Option 2      number

The badge (and the option title, if any) now sits in the key cell of the primitive row:

OPT 1         string
OPT 2         number

Titled options and untitled objects/arrays are unchanged: their header row carries the
description and hosts the children, so it is kept.

Tests

  • tests/unit/schema-utils.test.js: getTypeInfo returns any for annotation-only schemas
    (including x-*), and still reports a missing type for { minLength: 3 }.
  • tests/unit/schema-ast.test.js: untitled primitive options are unnamed, titled options and
    untitled objects keep their name.
  • npm run test:unit (472 pass), oxlint --deny-warnings, oxfmt --check.
  • Checked by rendering an OpenAPI file with the built bundle before and after
    (screenshots attached).

I did not run the e2e / visual suites, which may compare screenshots of the schema table.

sroucheray and others added 2 commits October 30, 2026 12:48
getTypeInfo only returned "any" for a completely empty schema. As soon as an
untyped schema carried a description (e.g. an `items` documented as "A string,
a number or a boolean"), the schema table rendered {missing-type-info}.

A schema that only carries annotations (title, description, example(s),
default, deprecated, readOnly, writeOnly, externalDocs, x-*) is now "any".
A schema with constraints but no type (e.g. minLength) still reports a missing
type.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A primitive option (string, number, boolean...) of a oneOf/anyOf took two
rows: the OPT n badge, then a row named "Option n" repeating it before the
type. The badge (and the title if any) now sits in the key cell of the
primitive row, next to its type and description. Titled options and untitled
objects/arrays keep their header row, it carries the description and hosts the
children.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mrin9
mrin9 merged commit e28b7ac into rapi-doc:master Nov 1, 2026
1 check failed
@mrin9

mrin9 commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Thanks for taking this one on urself

mrin9 added a commit that referenced this pull request Nov 1, 2026
Raise the range floors of @astrojs/starlight, @scalar/openapi-parser,
@apidevtools/json-schema-ref-parser, hono, @hono/node-server and
openid-client to their latest patch releases and regenerate the
lockfile. Every direct dependency was already on its latest major.

Rebuild rapidoc-min.js so the tracked bundle carries the untyped-schema
and primitive-oneOf fixes merged from #1164.
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