diff --git a/docs/api.md b/docs/api.md index a62af35..860843b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -167,8 +167,8 @@ __Options:__ - Provide any schema that has an `$id` with a ref as key, check `service.docs.refs` for allowed refs - This will add the schema and use it for the given ref - `docs` - Any service.docs options that will be merged into the resulting object and would overwrite anything that will be generated -- `sanitizeSchema` - A function that sanitizes the schema from properties that are not allowed in an OpenApi specification. - If not provided a default implementation will be used. +- `transformSchema` - A function that transforms the schema to a valid OpenApi schema. + If not provided a default implementation will be used which removes unsupported properties and adjust references. ### Path support to update nested structures diff --git a/docs/examples/authentication_v5.md b/docs/examples/authentication_v5.md index ac75e2c..b2fb7e1 100644 --- a/docs/examples/authentication_v5.md +++ b/docs/examples/authentication_v5.md @@ -1,7 +1,7 @@ ### Example with feathers generated authentication on feathersjs v5 (dove) 1. When you have generated the app with authentication you have to add some things to the initial - specs when registering feathers swagger. + specs when registering feathers-swagger. ```typescript app.configure( diff --git a/docs/examples/generated_service_v5.md b/docs/examples/generated_service_v5.md index 0ad083c..4e02757 100644 --- a/docs/examples/generated_service_v5.md +++ b/docs/examples/generated_service_v5.md @@ -2,33 +2,35 @@ 1. Go into your `src/services/{$name}` folder, and open the service you want to edit `${name}.[tj]s` 2. Import the helper function and import the schemas (example for user service): -```js {"highlight": "9-12", "lineNumbers": true} +```js {"highlight": "11-14", "lineNumbers": true} import { createSwaggerServiceOptions } from 'feathers-swagger'; import { - userDataValidator, - userQueryValidator, - userResolver, - userDataResolver, - userQueryResolver, - userExternalResolver, - userDataSchema, - userQuerySchema, - userSchema, - userPatchSchema, + userDataValidator, + userPatchValidator, + userQueryValidator, + userResolver, + userExternalResolver, + userDataResolver, + userPatchResolver, + userQueryResolver, + userSchema, + userDataSchema, + userPatchSchema, + userQuerySchema } from './users.schema'; ``` adjust the options when the service is generated ```js {"highlight": "6-12", "lineNumbers": true} app.use('users', new UserService(getOptions(app)), { // A list of all methods this service exposes externally - methods: ['find', 'get', 'create', 'update', 'patch', 'remove'], + methods: userMethods, // You can add additional custom events to be sent to clients here events: [], docs: createSwaggerServiceOptions({ - schemas: { userDataSchema, userQuerySchema, userSchema, userPatchSchema }, + schemas: { userSchema, userDataSchema, userPatchSchema, userQuerySchema }, docs: { // any options for service.docs can be added here - securities: ['find', 'get', 'update', 'patch', 'remove'], + securities: ['find', 'get', 'patch', 'remove'], } }), }); diff --git a/docs/examples/index.md b/docs/examples/index.md index 2a4cac7..7e29179 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -2,6 +2,8 @@ In addition to the examples you can access from the navigation, you can check out the [example application](https://github.com/feathersjs-ecosystem/feathers-swagger/tree/{GITHUB_BRANCH}/example) of the git repository. +There is also a [repository with examples of integrations of feathers-swagger](https://github.com/Mairu/feathersjs-swagger-tests). It contains multiple branches for different versions and configurations. + It contains many configurations and can be start with `npm start` when feathers-swagger have been checked out. ### List of examples diff --git a/docs/getting-started.md b/docs/getting-started.md index 3100149..e83752f 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -131,19 +131,24 @@ The docs property can be set as [path service options](https://dove.feathersjs.c ```typescript import type { createSwaggerServiceOptions } from 'feathers-swagger'; import { - messageDataSchema, - messageQuerySchema, + // ... messageSchema, -} from './message.schema'; + messageDataSchema, + messagePatchSchema, + messageQuerySchema +} from './messages.schema'; // ... app.use('message', new MessageService(), { - methods: ['find', 'get', 'create', 'update', 'patch', 'remove'], + methods: messageMethods, events: [], docs: createSwaggerServiceOptions({ schemas: { messageDataSchema, messageQuerySchema, messageSchema }, - docs: { description: 'My custom service description' } + docs: { + description: 'My custom service description', + securities: ['all'], + } }) }); ``` diff --git a/lib/utils.js b/lib/utils.js index a5af0c4..a8625cb 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -72,9 +72,8 @@ const allowedDefaultRefs = [ 'queryParameters' ]; -// Remove non OpenApi properties (properties from https://swagger.io/specification/#schema-object) -exports.defaultSanitizeSchema = function defaultSanitizeSchema (schema) { - return pick(schema, [ +exports.defaultTransformSchema = function defaultTransformSchema (schema) { + const allowedProperties = pick(schema, [ 'title', 'multipleOf', 'maximum', @@ -90,6 +89,8 @@ exports.defaultSanitizeSchema = function defaultSanitizeSchema (schema) { 'maxProperties', 'minProperties', 'required', + 'dependentRequired', + 'const', 'enum', 'type', 'allOf', @@ -109,8 +110,38 @@ exports.defaultSanitizeSchema = function defaultSanitizeSchema (schema) { 'xml', 'externalDocs', 'example', - 'deprecated' + 'deprecated', + '$ref', + '$dynamicRef', + '$anchor', + '$dynamicAnchor', + '$recursiveRef', + '$recursiveAnchor', + '$defs', + '$comment' ]); + + if (allowedProperties.$ref && !allowedProperties.$ref.includes('#')) { + allowedProperties.$ref = '#/components/schemas/' + allowedProperties.$ref; + } + + if (allowedProperties.items) { + allowedProperties.items = defaultTransformSchema(allowedProperties.items); + } + + if (allowedProperties.properties) { + allowedProperties.properties = Object.entries(allowedProperties.properties).reduce( + (previousValue, [key, value]) => { + return { + ...previousValue, + [key]: defaultTransformSchema(value) + }; + }, + {} + ); + } + + return allowedProperties; }; function determineSchemaPrefix (schemas) { @@ -134,9 +165,9 @@ function determineSchemaPrefix (schemas) { return undefined; } -exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ schemas, docs, sanitizeSchema }) { +exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ schemas, docs, transformSchema }) { const serviceDocs = { schemas: {}, refs: {} }; - const sanitizeSchemaFn = sanitizeSchema || exports.defaultSanitizeSchema; + const transformSchemaFn = transformSchema || exports.defaultTransformSchema; let unspecificSchemas; const prefix = determineSchemaPrefix(schemas); @@ -159,7 +190,7 @@ exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ sc const listSchemaName = `${baseSchemeName}List`; serviceDocs.schemas = { - [baseSchemeName]: sanitizeSchemaFn(resultSchema), + [baseSchemeName]: transformSchemaFn(resultSchema), [listSchemaName]: { type: 'array', items: { $ref: `#/components/schemas/${baseSchemeName}` } @@ -170,7 +201,7 @@ exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ sc if (dataSchema) { const dataSchemeName = dataSchema.$id || `${baseSchemeName}Data`; - serviceDocs.schemas[dataSchemeName] = sanitizeSchemaFn(dataSchema); + serviceDocs.schemas[dataSchemeName] = transformSchemaFn(dataSchema); serviceDocs.refs.createRequest = dataSchemeName; serviceDocs.refs.updateRequest = dataSchemeName; } @@ -181,13 +212,13 @@ exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ sc properties: omit(baseQuerySchema.properties, ['$limit', '$skip']) }; const querySchemaName = querySchema.$id || `${baseSchemeName}Query`; - serviceDocs.schemas[querySchemaName] = sanitizeSchemaFn(querySchema); + serviceDocs.schemas[querySchemaName] = transformSchemaFn(querySchema); serviceDocs.refs.queryParameters = querySchemaName; } if (patchSchema) { const patchSchemaName = patchSchema.$id || `${baseSchemeName}PatchData`; - serviceDocs.schemas[patchSchemaName] = sanitizeSchemaFn(patchSchema); + serviceDocs.schemas[patchSchemaName] = transformSchemaFn(patchSchema); serviceDocs.refs.patchRequest = patchSchemaName; } @@ -203,7 +234,7 @@ exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ sc Object.entries(unspecificSchemas).forEach(([key, schema]) => { const schemaName = schema.$id; if (schemaName) { - serviceDocs.schemas[schemaName] = sanitizeSchemaFn(schema); + serviceDocs.schemas[schemaName] = transformSchemaFn(schema); if (allowedDefaultRefs.includes(key)) { serviceDocs.refs[key] = schemaName; } diff --git a/package-lock.json b/package-lock.json index 80b2bc8..321ed41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,22 +1,22 @@ { "name": "feathers-swagger", - "version": "3.0.0-pre.1", + "version": "3.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "feathers-swagger", - "version": "3.0.0-pre.1", + "version": "3.0.0", "license": "MIT", "dependencies": { "lodash": "^4.17.21" }, "devDependencies": { - "@feathersjs/express": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", - "@feathersjs/koa": "^5.0.0-pre.36", - "@feathersjs/schema": "^5.0.0-pre.36", - "@feathersjs/typebox": "^5.0.0-pre.36", + "@feathersjs/express": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/koa": "^5.0.0", + "@feathersjs/schema": "^5.0.0", + "@feathersjs/typebox": "^5.0.0", "@koa/router": "^12.0.0", "@mairu/swagger-ui-apikey-auth-form": "^1.2.1", "@types/serve-static": "^1.13.10", @@ -461,9 +461,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz", + "integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==", "dev": true, "dependencies": { "regenerator-runtime": "^0.13.11" @@ -766,17 +766,17 @@ "dev": true }, "node_modules/@feathersjs/authentication": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/authentication/-/authentication-5.0.0-pre.36.tgz", - "integrity": "sha512-taVg/Kgfk8ShiOFFsFb8OH9poKhhBuP5unCLpfH/dzcjCEM78WjiKAdOmY5sJOK8Ye8u2zA2Ecn9YH/GxA1tvQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/authentication/-/authentication-5.0.0.tgz", + "integrity": "sha512-3BzEd7ZeKGMkFir1xexwvv8TyBj4CwCdQIGUi2NkG+YhcBA2BrzPE07wOkTJqv+Hk566PgBkTymA8FKARW8D+Q==", "dev": true, "dependencies": { - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", - "@feathersjs/hooks": "^0.7.6", - "@feathersjs/schema": "^5.0.0-pre.36", - "@feathersjs/transport-commons": "^5.0.0-pre.36", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/hooks": "^0.8.1", + "@feathersjs/schema": "^5.0.0", + "@feathersjs/transport-commons": "^5.0.0", "@types/jsonwebtoken": "^9.0.1", "jsonwebtoken": "^9.0.0", "lodash": "^4.17.21", @@ -792,9 +792,9 @@ } }, "node_modules/@feathersjs/commons": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/commons/-/commons-5.0.0-pre.36.tgz", - "integrity": "sha512-qTHGVyJBuXBIo1ecgCGAPuwu6jZLasFSKvLh3yldVdMb6DWYHgxv8IDCDBjds1aPxcifLNrJpwTVrbMJidwOCA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/commons/-/commons-5.0.0.tgz", + "integrity": "sha512-WTUQag+cIhkJ+Y7kS1lEy2T8i2AF7bO2qvIXdKM9jb4d92GCl5ZX2LrAlEgKY2Y8GUqm3EVfYXEqHq9ZUqdI8A==", "dev": true, "engines": { "node": ">= 12" @@ -805,27 +805,27 @@ } }, "node_modules/@feathersjs/errors": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/errors/-/errors-5.0.0-pre.36.tgz", - "integrity": "sha512-El7h2lUR3WznZcsF+Oyjbwx04IitB8HqwqTPDjJcr1yoWu3l6csySaaz34+nTV40Wjpo9nHErjK4Bu4T4WhtwQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/errors/-/errors-5.0.0.tgz", + "integrity": "sha512-bVir0nomgk8BSnpe5zcJ8JT2ly5xVsdH5KrMgA5f+E00NMu/2S8QoC3YF4WesYQ7WYg3uS6VulhPDj3MV6xLgw==", "dev": true, "engines": { "node": ">= 12" } }, "node_modules/@feathersjs/express": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/express/-/express-5.0.0-pre.36.tgz", - "integrity": "sha512-ZgLrFPWya2jmEpHt0mRNU+BF0V9ELzUplIjw/vauvFjz4CPjwxoHibCSUhbuQMXa8slQZYLqJLmxH49Gfj37+Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/express/-/express-5.0.0.tgz", + "integrity": "sha512-ymP27gCo390mhWJOOylnAo6xJqcDJLTSHChjPrexjLoLlq5V3rUwTOihRQQxasNdNTfqp7nSWK+44oUEl9x3TA==", "dev": true, "dependencies": { - "@feathersjs/authentication": "^5.0.0-pre.36", - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", - "@feathersjs/transport-commons": "^5.0.0-pre.36", + "@feathersjs/authentication": "^5.0.0", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/transport-commons": "^5.0.0", "@types/compression": "^1.7.2", - "@types/express": "^4.17.16", + "@types/express": "^4.17.17", "@types/express-serve-static-core": "^4.17.33", "compression": "^1.7.4", "cors": "^2.8.5", @@ -840,13 +840,13 @@ } }, "node_modules/@feathersjs/feathers": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/feathers/-/feathers-5.0.0-pre.36.tgz", - "integrity": "sha512-h6Ir765i29DSH4whCNGx6EQXyXLxD4A0dnU2ABaPUjGAc07M9n2AieHtAxWiPY63RSw3ECsG9A/45BWDiCe4KQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/feathers/-/feathers-5.0.0.tgz", + "integrity": "sha512-21rrKf4jFYEUHxMM/FeBiZODeXERSEMBVLTUbwCX9gtrbEH1okROz/u2piWS4LeYpeptiLu4i+S0xdvUe53H/Q==", "dev": true, "dependencies": { - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/hooks": "^0.7.6", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/hooks": "^0.8.1", "events": "^3.3.0" }, "engines": { @@ -858,27 +858,28 @@ } }, "node_modules/@feathersjs/hooks": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/@feathersjs/hooks/-/hooks-0.7.6.tgz", - "integrity": "sha512-MgEW8HKLbnaawjIuTUAkloeosKMtej4bw7eZWszASRPL4SUfEao34mTwSlIoNuPRew4WJG/NZGRah1qqU1JvhA==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@feathersjs/hooks/-/hooks-0.8.1.tgz", + "integrity": "sha512-q/OGjm2BEhT9cHYYcMZR4YKX4lHyufBJmi5Dz+XRM5YqUuEg9MYtR45CWgDiC1klrd2srNSsdmGNVU1otL4+0Q==", "dev": true, "engines": { "node": ">= 14" } }, "node_modules/@feathersjs/koa": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/koa/-/koa-5.0.0-pre.36.tgz", - "integrity": "sha512-jWtdqoPM6q8rki3wcpkMrq1moYT3H1cnxQarfWsVndBE7B0tVPUeRrggCU9SW1C+mGY8ZNIDkzfnhyIceKDPaw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/koa/-/koa-5.0.0.tgz", + "integrity": "sha512-wDcdJZF7UvMTb59xFwTRNti+ATAqcI9JoUVwtuJNHdOvm87MeX38Oe0fdcTKNfZMzRkaJanSiWJOKFC1kBAyHw==", "dev": true, "dependencies": { - "@feathersjs/authentication": "^5.0.0-pre.36", - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/transport-commons": "^5.0.0-pre.36", + "@feathersjs/authentication": "^5.0.0", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/transport-commons": "^5.0.0", "@koa/cors": "^4.0.0", "@types/koa": "^2.13.5", - "@types/koa__cors": "^3.3.0", + "@types/koa__cors": "^3.3.1", "@types/koa-bodyparser": "^4.3.10", "@types/koa-qs": "^2.0.0", "@types/koa-static": "^4.0.2", @@ -893,20 +894,20 @@ } }, "node_modules/@feathersjs/schema": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/schema/-/schema-5.0.0-pre.36.tgz", - "integrity": "sha512-TxoTRJS3FgfGI/hWiEI/xy/IDTwx/5UwX1s1xbfzKRxSppvA4EVKdBi9+YnsPPS/k849TP8airmvIz2WukcguA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/schema/-/schema-5.0.0.tgz", + "integrity": "sha512-9ovVaxDmE+ikk7BCIzanK1ixj4e01bcUpd430xVHiuRcopEqxFwlbKCtNTkqOvtBIk8lgdHLadSmTAry4q54Kw==", "dev": true, "dependencies": { - "@feathersjs/adapter-commons": "^5.0.0-pre.36", - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", - "@feathersjs/hooks": "^0.7.6", + "@feathersjs/adapter-commons": "^5.0.0", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/hooks": "^0.8.1", "@types/json-schema": "^7.0.11", "ajv": "^8.12.0", "ajv-formats": "^2.1.1", - "json-schema-to-ts": "^2.6.2" + "json-schema-to-ts": "^2.7.2" }, "engines": { "node": ">= 12" @@ -917,14 +918,14 @@ } }, "node_modules/@feathersjs/schema/node_modules/@feathersjs/adapter-commons": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/adapter-commons/-/adapter-commons-5.0.0-pre.36.tgz", - "integrity": "sha512-POi+/5QQ3BR7W15I9GKm6/Y+t+JQcXh2HL9WxY2ZR7LWY9kEWliuTpZzrZfjoph0B97DbT+YrGe79mWXb+KVuQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/adapter-commons/-/adapter-commons-5.0.0.tgz", + "integrity": "sha512-FHI82BgTMbKFy/v3HGTPFxf2048I1usU1CSUwkXK6udHIsKiJessqTok0FiV0IkGRT7RR/jo02xcq/NPSd0wvg==", "dev": true, "dependencies": { - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36" + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0" }, "engines": { "node": ">= 12" @@ -935,14 +936,14 @@ } }, "node_modules/@feathersjs/transport-commons": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/transport-commons/-/transport-commons-5.0.0-pre.36.tgz", - "integrity": "sha512-6Ra8J4l2NCvo6j9CIoY7BzE2zYxvwpc1yX6E8qBZ3XWmH896MQxR3RsR1dOw//01Z3Y3rhZHVe9AdC+Z3XfC1w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/transport-commons/-/transport-commons-5.0.0.tgz", + "integrity": "sha512-Z9S/TKnls1CHbNbwbHqKHPapRXcb8eDCZIeu66wEE0Rswhe5qkez2IZsyPlRrUV0kdKOEMWFV5LKX8FamthfTA==", "dev": true, "dependencies": { - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", "encodeurl": "^1.0.2", "lodash": "^4.17.21" }, @@ -955,13 +956,13 @@ } }, "node_modules/@feathersjs/typebox": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/typebox/-/typebox-5.0.0-pre.36.tgz", - "integrity": "sha512-Rmv1tnbwzRhbTvesPSNr459IGAQtrxzhr2J2T8Y7081vOLOnakNbWBzms0QywkUPLySxjnXHkO3OR54GJCUt2A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/typebox/-/typebox-5.0.0.tgz", + "integrity": "sha512-R0+1sp0o9X+yoY91noOJeIkSWrZs87fCyKzeeiQT8dlQ2oOf64vJTT3NBHNrIWqVBk8LICj7ge6Uf+BmzWkHJg==", "dev": true, "dependencies": { - "@feathersjs/schema": "^5.0.0-pre.36", - "@sinclair/typebox": "^0.25.21" + "@feathersjs/schema": "^5.0.0", + "@sinclair/typebox": "^0.25.24" }, "engines": { "node": ">= 12" @@ -1257,9 +1258,9 @@ } }, "node_modules/@sinclair/typebox": { - "version": "0.25.21", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", - "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==", + "version": "0.25.24", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", + "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==", "dev": true }, "node_modules/@tsd/typescript": { @@ -1422,9 +1423,9 @@ } }, "node_modules/@types/koa__cors": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@types/koa__cors/-/koa__cors-3.3.0.tgz", - "integrity": "sha512-FUN8YxcBakIs+walVe3+HcNP+Bxd0SB8BJHBWkglZ5C1XQWljlKcEFDG/dPiCIqwVCUbc5X0nYDlH62uEhdHMA==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/koa__cors/-/koa__cors-3.3.1.tgz", + "integrity": "sha512-aFGYhTFW7651KhmZZ05VG0QZJre7QxBxDj2LF1lf6GA/wSXEfKVAJxiQQWzRV4ZoMzQIO8vJBXKsUcRuvYK9qw==", "dev": true, "dependencies": { "@types/koa": "*" @@ -4734,15 +4735,14 @@ "dev": true }, "node_modules/json-schema-to-ts": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-2.6.2.tgz", - "integrity": "sha512-RrcvhZUcTAtfMVSvHIq3h/tELToha68V/1kGeQ2ggBv/4Bv31Zjbqis+b+Hiwibj6GO5WLA9PE4X93C8VTJ1TA==", + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-2.7.2.tgz", + "integrity": "sha512-R1JfqKqbBR4qE8UyBR56Ms30LL62/nlhoz+1UkfI/VE7p54Awu919FZ6ZUPG8zIa3XB65usPJgr1ONVncUGSaQ==", "dev": true, "dependencies": { "@babel/runtime": "^7.18.3", "@types/json-schema": "^7.0.9", - "ts-algebra": "^1.1.1", - "ts-toolbelt": "^9.6.0" + "ts-algebra": "^1.2.0" }, "engines": { "node": ">=16" @@ -4761,9 +4761,9 @@ "dev": true }, "node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, "bin": { "json5": "lib/cli.js" @@ -7417,18 +7417,9 @@ } }, "node_modules/ts-algebra": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-1.1.1.tgz", - "integrity": "sha512-W43a3/BN0Tp4SgRNERQF/QPVuY1rnHkgCr/fISLY0Ycu05P0NWPYRuViU8JFn+pFZuY6/zp9TgET1fxMzppR/Q==", - "dev": true, - "dependencies": { - "ts-toolbelt": "^9.6.0" - } - }, - "node_modules/ts-toolbelt": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/ts-toolbelt/-/ts-toolbelt-9.6.0.tgz", - "integrity": "sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-1.2.0.tgz", + "integrity": "sha512-kMuJJd8B2N/swCvIvn1hIFcIOrLGbWl9m/J6O3kHx9VRaevh00nvgjPiEGaRee7DRaAczMYR2uwWvXU22VFltw==", "dev": true }, "node_modules/tsconfig-paths": { @@ -7444,9 +7435,9 @@ } }, "node_modules/tsconfig-paths/node_modules/json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "dependencies": { "minimist": "^1.2.0" @@ -8220,9 +8211,9 @@ "dev": true }, "@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz", + "integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==", "dev": true, "requires": { "regenerator-runtime": "^0.13.11" @@ -8446,17 +8437,17 @@ } }, "@feathersjs/authentication": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/authentication/-/authentication-5.0.0-pre.36.tgz", - "integrity": "sha512-taVg/Kgfk8ShiOFFsFb8OH9poKhhBuP5unCLpfH/dzcjCEM78WjiKAdOmY5sJOK8Ye8u2zA2Ecn9YH/GxA1tvQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/authentication/-/authentication-5.0.0.tgz", + "integrity": "sha512-3BzEd7ZeKGMkFir1xexwvv8TyBj4CwCdQIGUi2NkG+YhcBA2BrzPE07wOkTJqv+Hk566PgBkTymA8FKARW8D+Q==", "dev": true, "requires": { - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", - "@feathersjs/hooks": "^0.7.6", - "@feathersjs/schema": "^5.0.0-pre.36", - "@feathersjs/transport-commons": "^5.0.0-pre.36", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/hooks": "^0.8.1", + "@feathersjs/schema": "^5.0.0", + "@feathersjs/transport-commons": "^5.0.0", "@types/jsonwebtoken": "^9.0.1", "jsonwebtoken": "^9.0.0", "lodash": "^4.17.21", @@ -8465,30 +8456,30 @@ } }, "@feathersjs/commons": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/commons/-/commons-5.0.0-pre.36.tgz", - "integrity": "sha512-qTHGVyJBuXBIo1ecgCGAPuwu6jZLasFSKvLh3yldVdMb6DWYHgxv8IDCDBjds1aPxcifLNrJpwTVrbMJidwOCA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/commons/-/commons-5.0.0.tgz", + "integrity": "sha512-WTUQag+cIhkJ+Y7kS1lEy2T8i2AF7bO2qvIXdKM9jb4d92GCl5ZX2LrAlEgKY2Y8GUqm3EVfYXEqHq9ZUqdI8A==", "dev": true }, "@feathersjs/errors": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/errors/-/errors-5.0.0-pre.36.tgz", - "integrity": "sha512-El7h2lUR3WznZcsF+Oyjbwx04IitB8HqwqTPDjJcr1yoWu3l6csySaaz34+nTV40Wjpo9nHErjK4Bu4T4WhtwQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/errors/-/errors-5.0.0.tgz", + "integrity": "sha512-bVir0nomgk8BSnpe5zcJ8JT2ly5xVsdH5KrMgA5f+E00NMu/2S8QoC3YF4WesYQ7WYg3uS6VulhPDj3MV6xLgw==", "dev": true }, "@feathersjs/express": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/express/-/express-5.0.0-pre.36.tgz", - "integrity": "sha512-ZgLrFPWya2jmEpHt0mRNU+BF0V9ELzUplIjw/vauvFjz4CPjwxoHibCSUhbuQMXa8slQZYLqJLmxH49Gfj37+Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/express/-/express-5.0.0.tgz", + "integrity": "sha512-ymP27gCo390mhWJOOylnAo6xJqcDJLTSHChjPrexjLoLlq5V3rUwTOihRQQxasNdNTfqp7nSWK+44oUEl9x3TA==", "dev": true, "requires": { - "@feathersjs/authentication": "^5.0.0-pre.36", - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", - "@feathersjs/transport-commons": "^5.0.0-pre.36", + "@feathersjs/authentication": "^5.0.0", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/transport-commons": "^5.0.0", "@types/compression": "^1.7.2", - "@types/express": "^4.17.16", + "@types/express": "^4.17.17", "@types/express-serve-static-core": "^4.17.33", "compression": "^1.7.4", "cors": "^2.8.5", @@ -8496,35 +8487,36 @@ } }, "@feathersjs/feathers": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/feathers/-/feathers-5.0.0-pre.36.tgz", - "integrity": "sha512-h6Ir765i29DSH4whCNGx6EQXyXLxD4A0dnU2ABaPUjGAc07M9n2AieHtAxWiPY63RSw3ECsG9A/45BWDiCe4KQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/feathers/-/feathers-5.0.0.tgz", + "integrity": "sha512-21rrKf4jFYEUHxMM/FeBiZODeXERSEMBVLTUbwCX9gtrbEH1okROz/u2piWS4LeYpeptiLu4i+S0xdvUe53H/Q==", "dev": true, "requires": { - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/hooks": "^0.7.6", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/hooks": "^0.8.1", "events": "^3.3.0" } }, "@feathersjs/hooks": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/@feathersjs/hooks/-/hooks-0.7.6.tgz", - "integrity": "sha512-MgEW8HKLbnaawjIuTUAkloeosKMtej4bw7eZWszASRPL4SUfEao34mTwSlIoNuPRew4WJG/NZGRah1qqU1JvhA==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@feathersjs/hooks/-/hooks-0.8.1.tgz", + "integrity": "sha512-q/OGjm2BEhT9cHYYcMZR4YKX4lHyufBJmi5Dz+XRM5YqUuEg9MYtR45CWgDiC1klrd2srNSsdmGNVU1otL4+0Q==", "dev": true }, "@feathersjs/koa": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/koa/-/koa-5.0.0-pre.36.tgz", - "integrity": "sha512-jWtdqoPM6q8rki3wcpkMrq1moYT3H1cnxQarfWsVndBE7B0tVPUeRrggCU9SW1C+mGY8ZNIDkzfnhyIceKDPaw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/koa/-/koa-5.0.0.tgz", + "integrity": "sha512-wDcdJZF7UvMTb59xFwTRNti+ATAqcI9JoUVwtuJNHdOvm87MeX38Oe0fdcTKNfZMzRkaJanSiWJOKFC1kBAyHw==", "dev": true, "requires": { - "@feathersjs/authentication": "^5.0.0-pre.36", - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/transport-commons": "^5.0.0-pre.36", + "@feathersjs/authentication": "^5.0.0", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/transport-commons": "^5.0.0", "@koa/cors": "^4.0.0", "@types/koa": "^2.13.5", - "@types/koa__cors": "^3.3.0", + "@types/koa__cors": "^3.3.1", "@types/koa-bodyparser": "^4.3.10", "@types/koa-qs": "^2.0.0", "@types/koa-static": "^4.0.2", @@ -8536,56 +8528,56 @@ } }, "@feathersjs/schema": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/schema/-/schema-5.0.0-pre.36.tgz", - "integrity": "sha512-TxoTRJS3FgfGI/hWiEI/xy/IDTwx/5UwX1s1xbfzKRxSppvA4EVKdBi9+YnsPPS/k849TP8airmvIz2WukcguA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/schema/-/schema-5.0.0.tgz", + "integrity": "sha512-9ovVaxDmE+ikk7BCIzanK1ixj4e01bcUpd430xVHiuRcopEqxFwlbKCtNTkqOvtBIk8lgdHLadSmTAry4q54Kw==", "dev": true, "requires": { - "@feathersjs/adapter-commons": "^5.0.0-pre.36", - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", - "@feathersjs/hooks": "^0.7.6", + "@feathersjs/adapter-commons": "^5.0.0", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/hooks": "^0.8.1", "@types/json-schema": "^7.0.11", "ajv": "^8.12.0", "ajv-formats": "^2.1.1", - "json-schema-to-ts": "^2.6.2" + "json-schema-to-ts": "^2.7.2" }, "dependencies": { "@feathersjs/adapter-commons": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/adapter-commons/-/adapter-commons-5.0.0-pre.36.tgz", - "integrity": "sha512-POi+/5QQ3BR7W15I9GKm6/Y+t+JQcXh2HL9WxY2ZR7LWY9kEWliuTpZzrZfjoph0B97DbT+YrGe79mWXb+KVuQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/adapter-commons/-/adapter-commons-5.0.0.tgz", + "integrity": "sha512-FHI82BgTMbKFy/v3HGTPFxf2048I1usU1CSUwkXK6udHIsKiJessqTok0FiV0IkGRT7RR/jo02xcq/NPSd0wvg==", "dev": true, "requires": { - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36" + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0" } } } }, "@feathersjs/transport-commons": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/transport-commons/-/transport-commons-5.0.0-pre.36.tgz", - "integrity": "sha512-6Ra8J4l2NCvo6j9CIoY7BzE2zYxvwpc1yX6E8qBZ3XWmH896MQxR3RsR1dOw//01Z3Y3rhZHVe9AdC+Z3XfC1w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/transport-commons/-/transport-commons-5.0.0.tgz", + "integrity": "sha512-Z9S/TKnls1CHbNbwbHqKHPapRXcb8eDCZIeu66wEE0Rswhe5qkez2IZsyPlRrUV0kdKOEMWFV5LKX8FamthfTA==", "dev": true, "requires": { - "@feathersjs/commons": "^5.0.0-pre.36", - "@feathersjs/errors": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", + "@feathersjs/commons": "^5.0.0", + "@feathersjs/errors": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", "encodeurl": "^1.0.2", "lodash": "^4.17.21" } }, "@feathersjs/typebox": { - "version": "5.0.0-pre.36", - "resolved": "https://registry.npmjs.org/@feathersjs/typebox/-/typebox-5.0.0-pre.36.tgz", - "integrity": "sha512-Rmv1tnbwzRhbTvesPSNr459IGAQtrxzhr2J2T8Y7081vOLOnakNbWBzms0QywkUPLySxjnXHkO3OR54GJCUt2A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@feathersjs/typebox/-/typebox-5.0.0.tgz", + "integrity": "sha512-R0+1sp0o9X+yoY91noOJeIkSWrZs87fCyKzeeiQT8dlQ2oOf64vJTT3NBHNrIWqVBk8LICj7ge6Uf+BmzWkHJg==", "dev": true, "requires": { - "@feathersjs/schema": "^5.0.0-pre.36", - "@sinclair/typebox": "^0.25.21" + "@feathersjs/schema": "^5.0.0", + "@sinclair/typebox": "^0.25.24" } }, "@humanwhocodes/config-array": { @@ -8816,9 +8808,9 @@ } }, "@sinclair/typebox": { - "version": "0.25.21", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", - "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==", + "version": "0.25.24", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", + "integrity": "sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==", "dev": true }, "@tsd/typescript": { @@ -8977,9 +8969,9 @@ } }, "@types/koa__cors": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@types/koa__cors/-/koa__cors-3.3.0.tgz", - "integrity": "sha512-FUN8YxcBakIs+walVe3+HcNP+Bxd0SB8BJHBWkglZ5C1XQWljlKcEFDG/dPiCIqwVCUbc5X0nYDlH62uEhdHMA==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/koa__cors/-/koa__cors-3.3.1.tgz", + "integrity": "sha512-aFGYhTFW7651KhmZZ05VG0QZJre7QxBxDj2LF1lf6GA/wSXEfKVAJxiQQWzRV4ZoMzQIO8vJBXKsUcRuvYK9qw==", "dev": true, "requires": { "@types/koa": "*" @@ -11454,15 +11446,14 @@ "dev": true }, "json-schema-to-ts": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-2.6.2.tgz", - "integrity": "sha512-RrcvhZUcTAtfMVSvHIq3h/tELToha68V/1kGeQ2ggBv/4Bv31Zjbqis+b+Hiwibj6GO5WLA9PE4X93C8VTJ1TA==", + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/json-schema-to-ts/-/json-schema-to-ts-2.7.2.tgz", + "integrity": "sha512-R1JfqKqbBR4qE8UyBR56Ms30LL62/nlhoz+1UkfI/VE7p54Awu919FZ6ZUPG8zIa3XB65usPJgr1ONVncUGSaQ==", "dev": true, "requires": { "@babel/runtime": "^7.18.3", "@types/json-schema": "^7.0.9", - "ts-algebra": "^1.1.1", - "ts-toolbelt": "^9.6.0" + "ts-algebra": "^1.2.0" } }, "json-schema-traverse": { @@ -11478,9 +11469,9 @@ "dev": true }, "json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, "jsonwebtoken": { @@ -13479,18 +13470,9 @@ "dev": true }, "ts-algebra": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-1.1.1.tgz", - "integrity": "sha512-W43a3/BN0Tp4SgRNERQF/QPVuY1rnHkgCr/fISLY0Ycu05P0NWPYRuViU8JFn+pFZuY6/zp9TgET1fxMzppR/Q==", - "dev": true, - "requires": { - "ts-toolbelt": "^9.6.0" - } - }, - "ts-toolbelt": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/ts-toolbelt/-/ts-toolbelt-9.6.0.tgz", - "integrity": "sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ts-algebra/-/ts-algebra-1.2.0.tgz", + "integrity": "sha512-kMuJJd8B2N/swCvIvn1hIFcIOrLGbWl9m/J6O3kHx9VRaevh00nvgjPiEGaRee7DRaAczMYR2uwWvXU22VFltw==", "dev": true }, "tsconfig-paths": { @@ -13506,9 +13488,9 @@ }, "dependencies": { "json5": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", - "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", "dev": true, "requires": { "minimist": "^1.2.0" diff --git a/package.json b/package.json index fdce1fc..3cfb5ce 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "feathers-swagger", "description": "Add documentation to your Feathers services and feed them to Swagger UI.", - "version": "3.0.0-pre.1", + "version": "3.0.0", "homepage": "https://feathersjs-ecosystem.github.io/feathers-swagger", "main": "lib/", "keywords": [ @@ -62,11 +62,11 @@ "lodash": "^4.17.21" }, "devDependencies": { - "@feathersjs/express": "^5.0.0-pre.36", - "@feathersjs/feathers": "^5.0.0-pre.36", - "@feathersjs/koa": "^5.0.0-pre.36", - "@feathersjs/schema": "^5.0.0-pre.36", - "@feathersjs/typebox": "^5.0.0-pre.36", + "@feathersjs/express": "^5.0.0", + "@feathersjs/feathers": "^5.0.0", + "@feathersjs/koa": "^5.0.0", + "@feathersjs/schema": "^5.0.0", + "@feathersjs/typebox": "^5.0.0", "@koa/router": "^12.0.0", "@mairu/swagger-ui-apikey-auth-form": "^1.2.1", "@types/serve-static": "^1.13.10", diff --git a/test/utils.test.js b/test/utils.test.js index 52f405c..3db8838 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -18,7 +18,10 @@ describe('util tests', () => { }; it('should provide spec defaults for empty service.docs.operations[method] and defaults', () => { - expect(operation('find', { docs: {}, find () {} }, {})).to.deep.equal({ + expect(operation('find', { + docs: {}, find() { + } + }, {})).to.deep.equal({ parameters: [], responses: {}, description: '', @@ -31,7 +34,10 @@ describe('util tests', () => { }); it('should consume defaults', () => { - expect(operation('find', { docs: {}, find () {} }, defaults)).to.deep.equal(defaults); + expect(operation('find', { + docs: {}, find() { + } + }, defaults)).to.deep.equal(defaults); }); it('should prefer prefer method.docs over service.docs.operations[method] overservice.docs.operations.all ', () => { @@ -48,7 +54,8 @@ describe('util tests', () => { } } }, - find () {} + find() { + } }; service.find.docs = { description: 'description of find.docs' @@ -76,7 +83,8 @@ describe('util tests', () => { } } }, - find () {} + find() { + } }; expect(operation('find', service, {}, { nested: { object: 'value' } })).to.deep.equal({ @@ -179,6 +187,11 @@ describe('util tests', () => { $id: 'MessagePatch' }); + const topicSchema = Type.Object( + { name: Type.String(), messages: Type.Array(Type.Ref(messageSchema)), stickyMessage: Type.Ref(messageSchema) }, + { $id: 'Topic', additionalProperties: false } + ); + it('with refs and list when all generated schemas are provided', () => { const result = createSwaggerServiceOptions({ schemas: { @@ -213,7 +226,13 @@ describe('util tests', () => { }); it('with refs and list when some generated schemas are provided', () => { - const result = createSwaggerServiceOptions({ schemas: { messageDataSchema, messageSchema, messageQuerySchema } }); + const result = createSwaggerServiceOptions({ + schemas: { + messageDataSchema, + messageSchema, + messageQuerySchema + } + }); expect(result).to.deep.equal({ schemas: { @@ -268,6 +287,71 @@ describe('util tests', () => { } }); }); + + it('with schema references', () => { + const result = createSwaggerServiceOptions({ schemas: { getResponse: topicSchema } }); + + expect(result).to.deep.equal({ + schemas: { + Topic: { + type: 'object', + properties: { + name: { + type: 'string' + }, + stickyMessage: { + $ref: '#/components/schemas/Message' + }, + messages: { + type: 'array', + items: { + $ref: '#/components/schemas/Message' + }, + }, + }, + required: [ + 'name', + 'messages', + 'stickyMessage' + ], + additionalProperties: false, + } + }, + refs: { + getResponse: 'Topic' + } + }); + }); + }); + + it('should use custom transformSchema function', () => { + const jsonSchema = { + $id: 'SimpleIdObject', + type: 'object', + additionalProperties: false, + required: ['id'], + properties: { + id: { + type: 'number', + } + } + }; + + const result = createSwaggerServiceOptions({ + schemas: { getResponse: jsonSchema }, + transformSchema: (schema) => ({ destroyed: true }), + }); + + expect(result).to.deep.equal({ + schemas: { + SimpleIdObject: { + destroyed: true + } + }, + refs: { + getResponse: 'SimpleIdObject' + } + }); }); }); }); diff --git a/types/index.d.ts b/types/index.d.ts index dda0e41..f581515 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -308,8 +308,8 @@ declare namespace feathersSwagger { [propName: string]: Schema | undefined; }, docs?: ServiceSwaggerOptions, - sanitizeSchema?: (schema: Schema) => Record, + transformSchema?: (schema: Schema) => Record, }): ServiceSwaggerOptions; - function defaultSanitizeSchema(schema: Schema): Record; + function defaultTransformSchema(schema: Schema): Record; } diff --git a/types/index.test-d.ts b/types/index.test-d.ts index d885a57..b54aed1 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -14,10 +14,9 @@ import swagger, { customMethodsHandler, customMethod, createSwaggerServiceOptions, - defaultSanitizeSchema, + defaultTransformSchema, } from './index'; - // complete expectType<() => void>(swagger({ specs: { @@ -442,13 +441,13 @@ createSwaggerServiceOptions({ customSchema: schema, }, docs: { description: 'any docs props' }, - sanitizeSchema: () => ({ 'description': 'content' }), + transformSchema: () => ({ 'description': 'content' }), }); createSwaggerServiceOptions({ schemas: {}, // Schemas are optional docs: { description: 'any docs props' }, - sanitizeSchema: () => ({ 'description': 'content' }), + transformSchema: () => ({ 'description': 'content' }), }); -expectType>(defaultSanitizeSchema(schema)); +expectType>(defaultTransformSchema(schema));