Skip to content

Fix SchemaParameter.schema type in openapi-3-1 (OasSchema32 -> OasSchema31) - #137

Open
tarunagnihotri534 wants to merge 1 commit into
hyperjump-io:mainfrom
tarunagnihotri534:fix/openapi-3-1-schema-parameter-type
Open

tarunagnihotri534 wants to merge 1 commit into
hyperjump-io:mainfrom
tarunagnihotri534:fix/openapi-3-1-schema-parameter-type

Conversation

@tarunagnihotri534

@tarunagnihotri534 tarunagnihotri534 commented Oct 19, 2026 •

Copy link
Copy Markdown

Summary

Fixes a typing error in openapi-3-1/index.d.ts where SchemaParameter.schema was typed as OasSchema32 instead of OasSchema31.

Root Cause

SchemaParameter was copied over from openapi-3-2/index.d.ts in commit a52c3d0 ("OpenApi type improvements") and the schema type was never switched back to the 3.1 one. OasSchema32 isn't declared or imported in openapi-3-1/index.d.ts, so anyone type-checking declaration files with skipLibCheck: false hits this error when importing from @hyperjump/json-schema/openapi-3-1:

openapi-3-1/index.d.ts(230,11): error TS2552: Cannot find name 'OasSchema32'. Did you mean 'OasSchema31'?

It went unnoticed because the repo's tsconfig.json has skipLibCheck: true and no .ts file imports SchemaParameter, so npm run check-types never looked at it.

Changes

  • Changed SchemaParameter.schema from OasSchema32 to OasSchema31, matching MediaType.schema and Header.schema in the same file.
  • Added openapi-3-1/index.spec.ts, a small type-level regression test that imports Parameter and SchemaParameter, so npm run check-types now exercises these types.

Testing

Added openapi-3-1/index.spec.ts (Vitest expectTypeOf), with two tests:

  • SchemaParameter["schema"] is not any and is exactly OasSchema31.
  • The public Parameter union exposes the same OasSchema31 type for its schema variants.

Because the bug lives in a .d.ts file, the test is checked at compile time by npm run check-types, not at runtime. Before the fix, the unresolved OasSchema32 is treated as any, so the type check fails:

openapi-3-1/index.spec.ts(8,51): error TS2349: This expression is not callable.
  Type 'Inverted<ExpectAny<OasSchema32>>' has no call signatures.

To run it locally:

npm run check-types
npm test

Verification

  • npm run check-types fails on the unfixed code and passes with the fix.
  • npm test passes (29 test files, 15,003 tests) and eslint reports no errors.
  • Compiling openapi-3-1/index.d.ts with --skipLibCheck false no longer reports the OasSchema32 error. The remaining errors from @hyperjump/browser are unrelated and out of scope here.

Fixes #135

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.

[BUG]: Type error in openapi-3-1/index.d.ts: SchemaParameter.schema references undeclared OasSchema32

1 participant