Skip to content

fix(types): update validator and serializer compiler signatures to accept route definition - #190

Open
abhi-byte62 wants to merge 1 commit into
fastify:mainfrom
abhi-byte62:fix/validator-compiler-route-definition-types
Open

abhi-byte62 wants to merge 1 commit into
fastify:mainfrom
abhi-byte62:fix/validator-compiler-route-definition-types

Conversation

@abhi-byte62

Copy link
Copy Markdown

Description

This PR aligns the TypeScript declaration for \AjvCompile\ and \AjvJTDCompile\ in \ ypes/index.d.ts\ with the actual runtime implementation in \lib/validator-compiler.js\ and \lib/serializer-compiler.js.

Summary of Changes

  • Updated Compiler Signatures: \AjvCompile\ and \AjvJTDCompile\ now accept \AjvCompiler.RouteDefinition\ ({ schema, method?, url?, httpPart?, httpStatus? }) instead of expecting a bare \schema\ argument.
  • RouteDefinition Properties: Added optional route context properties (\method?, \url?, \httpPart?, \httpStatus?) to allow calling the compiled function with either minimal { schema }\ or the full route options passed by Fastify.
  • Factory / Compiler Types: Added symmetric \SerializerFactory\ and \SerializerCompiler\ type aliases.
  • Type Tests: Added \ styche\ assertions in \ ypes/index.tst.ts\ verifying compatibility with full and minimal \RouteDefinition\ objects and compiler return types.

Fixes #188

…cept route definition

Update AjvCompile and AjvJTDCompile to accept RouteDefinition matching the runtime implementation in validator-compiler.js and serializer-compiler.js. Add SerializerFactory and SerializerCompiler types.

Fixes fastify#188

This branch has not been deployed

No deployments
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.

Typing of ValidatorCompiler seem wrong

1 participant