Skip to content

Releases: ata-core/fastify-ata

v0.6.0

Choose a tag to compare

@mertcanaltin mertcanaltin released this 27 May 17:11

Requires ata-validator@^0.20.0 for the new chainable builder at ata-validator/t. README shows the TypeBox-style authoring path on a Fastify route, and test-t-builder.js pins the contract end-to-end so future ata bumps cannot silently break the migration.

v0.5.0

Choose a tag to compare

@mertcanaltin mertcanaltin released this 25 May 15:24

Requires ata-validator 0.18.0, whose Infer resolves anyOf/oneOf to unions, allOf to an intersection, prefixItems to tuples, and local $ref.

Request bodies now narrow to those shapes through AtaTypeProvider with no manual annotation. Type tests cover the union, the referenced type, and the intersection cases. No code change to the provider itself: it builds on Infer and inherits the wider inference.

v0.4.2

Choose a tag to compare

@mertcanaltin mertcanaltin released this 25 May 11:56

Fixed

  • The plugin now passes schemas registered via fastify.addSchema to ata, so cross-schema $ref (e.g. { $ref: 'shared#' }) resolves through the register(fastifyAta) path. Previously the validator was built without external schemas, so any addSchema reference failed with cannot resolve $ref. Both external $id refs and draft-07 #anchor refs are now resolved and enforced.

Changed

  • Requires ata-validator ^0.17.5 (draft-07 plain-name anchor resolution).

v0.4.0

Choose a tag to compare

@mertcanaltin mertcanaltin released this 23 May 20:29

TypeScript type provider and ata-validator 0.17.

  • AtaTypeProvider: use Fastify().withTypeProvider<fastifyAta.AtaTypeProvider>() and author route schemas with defineSchema(...) from ata-validator, and request.body / request.query / request.params are typed from the schema with no manual annotation. Plain JSON Schema, no builder DSL. Type-level only.
  • Bumped to ata-validator@^0.17.0 (cross-schema $ref, nullable, coerceTypes array, and the validateAndParse fix).
  • prettyErrors option renders compiler-grade error messages (ATA code + did-you-mean) in 400 responses.

v0.3.0

Choose a tag to compare

@mertcanaltin mertcanaltin released this 24 Apr 10:25

Aligned with ata-validator@0.11.0 / 0.11.1.

Added

  • abortEarly option passes through to the validator. On failure the plugin returns a shared stub result instead of running the detailed error collector. On a 10-property schema the invalid path drops from roughly 15 ns/op to 3.7 ns/op. Useful for high-throughput route guards that only need accept / reject.
fastify.register(require('fastify-ata'), {
  coerceTypes: true,
  removeAdditional: true,
  abortEarly: true,
})

Fixed

  • Removed an accidental self-dependency (fastify-ata depending on fastify-ata) in package.json.
  • Dropped the turbo option from the type declarations — it was never implemented in the current surface.

Docs

Updated README with the numbers verified against ata-validator@0.11.x on M4 Pro / Node 25:

  • Fastify pipeline: tied on valid, +3% on invalid
  • Serverless cold start (10 routes, first request): 12.4 ms → 0.5 ms (~24x)
  • abortEarly invalid path: 4x

Added a section on the new ata compile CLI for browser / edge deployments.

Install

npm install fastify-ata@0.3.0