Skip to content

fix(openapi): support untyped oneOf query properties - #945

Open
lprnmns wants to merge 1 commit into
fastify:mainfrom
lprnmns:fix/query-oneof-properties-without-type-dco
Open

fix(openapi): support untyped oneOf query properties#945
lprnmns wants to merge 1 commit into
fastify:mainfrom
lprnmns:fix/query-oneof-properties-without-type-dco

Conversation

@lprnmns

@lprnmns lprnmns commented Aug 31, 2026

Copy link
Copy Markdown

Problem

When a query schema uses oneOf branches with properties but no explicit type, the generated OpenAPI document treats the literal properties object as a query parameter. For the current reproduction from #633, this produces an invalid parameter and Swagger/OpenAPI validation fails.

Fix

Allow the existing local-parameter resolver to expand schemas based on properties without requiring an explicit type. Explicitly typed schemas retain their existing behavior; untyped object branches now generate the intended query parameters.

Tests

  • npm run test && npm run benchmark --if-present — passed; 267 unit tests, 8 type assertions, strict 100% coverage; no benchmark script is defined.
  • npm run lint — passed.
  • node --check lib/util/resolve-local-ref.js — passed.
  • node --check test/spec/openapi/refs.test.js — passed.
  • git diff HEAD^ HEAD --check — passed.

Compatibility

This is a narrow compatibility fix for valid JSON Schema object branches that omit type. Existing schemas with an explicit type follow the same code path; the change adds no public option, dependency, or version change.

Related issue

Fixes #633

Checklist

  • run npm run test && npm run benchmark --if-present
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message and code follows the Developer's Certificate of Origin and the Code of conduct

Signed-off-by: lprnmns <manasalperen@gmail.com>
@lprnmns
lprnmns marked this pull request as ready for review August 31, 2026 16:20
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.

properties keyword inside oneOf keyword in query causes Fastify to crash

1 participant