Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-type-provider-zod

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-type-provider-zod - npm Package Compare versions

Comparing version 1.1.8 to 1.1.9

0

.eslintrc.json

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ {

2

dist/index.d.ts
import type { FastifySchema, FastifySchemaCompiler, FastifyTypeProvider } from 'fastify';
import type { FastifySerializerCompiler } from 'fastify/types/schema';
import type { z, ZodAny, ZodTypeAny } from 'zod';
declare type FreeformRecord = Record<string, any>;
type FreeformRecord = Record<string, any>;
export interface ZodTypeProvider extends FastifyTypeProvider {

@@ -6,0 +6,0 @@ output: this['input'] extends ZodTypeAny ? z.infer<this['input']> : never;

@@ -41,3 +41,4 @@ "use strict";

var zodToJsonSchemaOptions = {
target: 'openApi3'
target: 'openApi3',
$refStrategy: 'none'
};

@@ -44,0 +45,0 @@ var createJsonSchemaTransform = function (_a) {

@@ -0,0 +0,0 @@ {

{
"name": "fastify-type-provider-zod",
"version": "1.1.8",
"version": "1.1.9",
"description": "Zod Type Provider for Fastify@4",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -0,0 +0,0 @@ # Fastify Type Provider Zod

@@ -29,2 +29,3 @@ import type { FastifySchema, FastifySchemaCompiler, FastifyTypeProvider } from 'fastify';

target: 'openApi3',
$refStrategy: 'none',
} as const;

@@ -31,0 +32,0 @@

@@ -97,2 +97,50 @@ import fastifySwagger from '@fastify/swagger';

});
it('should not generate ref', async () => {
const app = Fastify();
app.setValidatorCompiler(validatorCompiler);
app.setSerializerCompiler(serializerCompiler);
app.register(fastifySwagger, {
openapi: {
info: {
title: 'SampleApi',
description: 'Sample backend service',
version: '1.0.0',
},
servers: [],
},
transform: jsonSchemaTransform,
});
app.register(fastifySwaggerUI, {
routePrefix: '/documentation',
});
const TOKEN_SCHEMA = z.string().length(12);
app.after(() => {
app.withTypeProvider<ZodTypeProvider>().route({
method: 'POST',
url: '/login',
schema: {
body: z.object({
access_token: TOKEN_SCHEMA,
refresh_token: TOKEN_SCHEMA,
}),
},
handler: (req, res) => {
res.send('ok');
},
});
});
await app.ready();
const openApiSpecResponse = await app.inject().get('/documentation/json');
const openApiSpec = JSON.parse(openApiSpecResponse.body);
expect(openApiSpec).toMatchSnapshot();
await validator.validate(openApiSpec, {});
});
});

@@ -0,0 +0,0 @@ import type { FastifyInstance } from 'fastify';

@@ -0,0 +0,0 @@ import type { FastifyInstance } from 'fastify';

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ import type {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc