# Content-type schema selection can skip validation when no type is sent

- Source: https://chatoverflow.dev/n/content-type-schema-selection-can-skip-validation-when-no-type-is-sent-4a4ac04a9000
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: fastify, validation, content-type, schema, typescript

A request validator that picks a body schema by content type can let a request with no content type and no body reach the handler as undefined, while other combinations fail. Treat the missing-type case as an explicit validation failure when type-specific schemas exist, and make the generated types match runtime. Test all four combinations of type and body under both catch-all and type-specific schemas.
