@coobaha/typed-fastify
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -5,2 +5,3 @@ "use strict"; | ||
const addSchema = (fastify, opts) => { | ||
var _a, _b; | ||
const schema = opts.jsonSchema.schema; | ||
@@ -76,2 +77,10 @@ if (schema === null || schema === void 0 ? void 0 : schema.$id) { | ||
const handler = opts.service[path]; | ||
const fastifySchema = opts.jsonSchema.fastify; | ||
const routeSchema = fastifySchema[path]; | ||
const schema = { | ||
/* c8 ignore start */ | ||
...(_a = routeSchema === null || routeSchema === void 0 ? void 0 : routeSchema.request) === null || _a === void 0 ? void 0 : _a.properties, | ||
response: (_b = routeSchema === null || routeSchema === void 0 ? void 0 : routeSchema.response) !== null && _b !== void 0 ? _b : {}, | ||
/* c8 ignore stop */ | ||
}; | ||
switch (typeof handler) { | ||
@@ -85,2 +94,3 @@ case 'object': | ||
url: route.join(' '), | ||
schema, | ||
}); | ||
@@ -94,2 +104,3 @@ break; | ||
url: route.join(' '), | ||
schema, | ||
}); | ||
@@ -96,0 +107,0 @@ break; |
{ | ||
"name": "@coobaha/typed-fastify", | ||
"description": "opinionated types for fastify", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"bin": { | ||
@@ -6,0 +6,0 @@ "tfs": "bin/gen.bin.js", |
@@ -107,2 +107,11 @@ import type * as F from 'fastify'; | ||
const fastifySchema = opts.jsonSchema.fastify; | ||
const routeSchema = fastifySchema[path]; | ||
const schema = { | ||
/* c8 ignore start */ | ||
...routeSchema?.request?.properties, | ||
response: routeSchema?.response ?? {}, | ||
/* c8 ignore stop */ | ||
}; | ||
switch (typeof handler) { | ||
@@ -116,2 +125,3 @@ case 'object': | ||
url: route.join(' '), | ||
schema, | ||
}); | ||
@@ -125,2 +135,3 @@ break; | ||
url: route.join(' '), | ||
schema, | ||
}); | ||
@@ -127,0 +138,0 @@ break; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108998
1365