From 0e441676bde1c553284ff87610bbfd89305aa073 Mon Sep 17 00:00:00 2001 From: Romain Lenzotti Date: Sun, 8 Dec 2024 13:47:47 +0100 Subject: [PATCH] feat(scalar): add @tsed/scalar package --- docs/index.md | 2 +- docs/tutorials/scalar.md | 8 +- docs/tutorials/swagger.md | 8 +- packages/core/tsconfig.spec.json | 1 + packages/di/tsconfig.spec.json | 1 + packages/engines/tsconfig.spec.json | 1 + packages/graphql/apollo/tsconfig.spec.json | 1 + .../graphql/typegraphql/tsconfig.spec.json | 1 + .../orm/adapters-redis/tsconfig.spec.json | 1 + packages/orm/adapters/tsconfig.spec.json | 1 + packages/orm/ioredis/tsconfig.spec.json | 1 + packages/orm/mikro-orm/tsconfig.spec.json | 1 + packages/orm/mongoose/tsconfig.spec.json | 1 + packages/orm/objection/tsconfig.spec.json | 1 + packages/orm/prisma/tsconfig.spec.json | 1 + packages/platform/common/tsconfig.spec.json | 1 + .../platform-cache/tsconfig.spec.json | 1 + .../platform-exceptions/tsconfig.spec.json | 1 + .../platform-express/tsconfig.spec.json | 1 + .../platform/platform-http/tsconfig.spec.json | 1 + .../platform/platform-koa/tsconfig.spec.json | 1 + .../tsconfig.spec.json | 1 + .../platform-log-request/tsconfig.spec.json | 1 + .../platform-middlewares/tsconfig.spec.json | 1 + .../platform-params/tsconfig.spec.json | 1 + .../tsconfig.spec.json | 1 + .../platform-router/tsconfig.spec.json | 1 + .../tsconfig.spec.json | 1 + .../platform-serverless/tsconfig.spec.json | 1 + .../platform-views/tsconfig.spec.json | 1 + packages/security/jwks/tsconfig.spec.json | 1 + .../tsconfig.spec.json | 1 + .../security/oidc-provider/tsconfig.spec.json | 1 + packages/security/passport/tsconfig.spec.json | 1 + packages/specs/ajv/tsconfig.spec.json | 1 + packages/specs/exceptions/tsconfig.spec.json | 1 + packages/specs/json-mapper/tsconfig.spec.json | 1 + .../src/services/OpenAPIBaseModule.ts | 2 +- packages/specs/scalar/.npmignore | 7 + packages/specs/scalar/package.json | 57 +++++ packages/specs/scalar/readme.md | 214 ++++++++++++++++++ .../specs/scalar/src/ScalarModule.spec.ts | 60 +++++ packages/specs/scalar/src/ScalarModule.ts | 46 ++++ packages/specs/scalar/src/constants.ts | 3 + packages/specs/scalar/src/exports.ts | 1 + packages/specs/scalar/src/index.ts | 8 + .../scalar/src/interfaces/ScalarSettings.ts | 9 + .../scalar/src/middlewares/indexMiddleware.ts | 30 +++ .../scalar.integration.spec.ts.snap | 143 ++++++++++++ packages/specs/scalar/test/app/Server.ts | 40 ++++ .../specs/scalar/test/app/class/classes.ts | 114 ++++++++++ packages/specs/scalar/test/app/index.ts | 125 ++++++++++ .../specs/scalar/test/app/models/Calendar.ts | 14 ++ .../scalar/test/scalar.integration.spec.ts | 99 ++++++++ packages/specs/scalar/tsconfig.esm.json | 26 +++ packages/specs/scalar/tsconfig.json | 22 ++ packages/specs/scalar/tsconfig.spec.json | 37 +++ packages/specs/scalar/views/assets/scalar.css | 96 ++++++++ packages/specs/scalar/views/scalar.ejs | 19 ++ packages/specs/scalar/vitest.config.mts | 21 ++ packages/specs/schema/tsconfig.spec.json | 1 + packages/specs/swagger/package.json | 1 + .../specs/swagger/src/SwaggerModule.spec.ts | 2 +- packages/specs/swagger/src/exports.ts | 1 + .../specs/swagger/views/assets/swagger.css | 16 ++ .../third-parties/agenda/tsconfig.spec.json | 1 + .../third-parties/bullmq/tsconfig.spec.json | 1 + .../components-scan/tsconfig.spec.json | 1 + .../event-emitter/tsconfig.spec.json | 1 + .../third-parties/formio/tsconfig.spec.json | 1 + .../normalize-path/tsconfig.spec.json | 1 + .../third-parties/pulse/tsconfig.spec.json | 1 + .../schema-formio/tsconfig.spec.json | 1 + .../third-parties/socketio/tsconfig.spec.json | 1 + packages/third-parties/sse/tsconfig.spec.json | 1 + .../third-parties/stripe/tsconfig.spec.json | 1 + .../third-parties/temporal/tsconfig.spec.json | 1 + .../third-parties/terminus/tsconfig.spec.json | 1 + .../third-parties/vike/tsconfig.spec.json | 1 + tools/integration/tsconfig.json | 3 + tsconfig.json | 6 + yarn.lock | 127 +++++++++-- 82 files changed, 1387 insertions(+), 29 deletions(-) create mode 100644 packages/specs/scalar/.npmignore create mode 100644 packages/specs/scalar/package.json create mode 100644 packages/specs/scalar/readme.md create mode 100644 packages/specs/scalar/src/ScalarModule.spec.ts create mode 100644 packages/specs/scalar/src/ScalarModule.ts create mode 100644 packages/specs/scalar/src/constants.ts create mode 100644 packages/specs/scalar/src/exports.ts create mode 100644 packages/specs/scalar/src/index.ts create mode 100644 packages/specs/scalar/src/interfaces/ScalarSettings.ts create mode 100644 packages/specs/scalar/src/middlewares/indexMiddleware.ts create mode 100644 packages/specs/scalar/test/__snapshots__/scalar.integration.spec.ts.snap create mode 100644 packages/specs/scalar/test/app/Server.ts create mode 100644 packages/specs/scalar/test/app/class/classes.ts create mode 100644 packages/specs/scalar/test/app/index.ts create mode 100644 packages/specs/scalar/test/app/models/Calendar.ts create mode 100644 packages/specs/scalar/test/scalar.integration.spec.ts create mode 100644 packages/specs/scalar/tsconfig.esm.json create mode 100644 packages/specs/scalar/tsconfig.json create mode 100644 packages/specs/scalar/tsconfig.spec.json create mode 100644 packages/specs/scalar/views/assets/scalar.css create mode 100644 packages/specs/scalar/views/scalar.ejs create mode 100644 packages/specs/scalar/vitest.config.mts create mode 100644 packages/specs/swagger/src/exports.ts create mode 100644 packages/specs/swagger/views/assets/swagger.css diff --git a/docs/index.md b/docs/index.md index 1150527e6b5..79c41eb27f8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -89,7 +89,7 @@ frameworks: src: /swagger.svg - title: Scalar href: /tutorials/scalar.html - src: /swagger.svg + src: /scalar.svg - title: Passport href: /tutorials/passport.html src: /passportjs.png diff --git a/docs/tutorials/scalar.md b/docs/tutorials/scalar.md index 4e0d75dd153..f250fc87512 100644 --- a/docs/tutorials/scalar.md +++ b/docs/tutorials/scalar.md @@ -11,8 +11,8 @@ meta: This page shows you how you can configure Scalar with Ts.ED. Scalar uses the OpenApi -to describe a Rest API. Ts.ED operates the existing decorators to build -a spec compliant with Scalar. +to describe a Rest API. Ts.ED uses existing decorators to build +a specification compliant with Scalar. ## Installation @@ -126,7 +126,7 @@ export class Server {} ## Model documentation -One of the feature of Ts.ED is the model definition to serialize or deserialize a +One of the features of Ts.ED is the model definition to serialize or deserialize a JSON Object based on JsonSchema (See [model documentation](/docs/model.md)). A model can be used on a method controller along with @@BodyParams@@ or other decorators. @@ -142,7 +142,7 @@ This example shows you how to use the decorators to generate Scalar documentatio ## Extra parameters Sometimes you want to display extra `in` parameters like `headers` without consuming it in an endpoint. -It's possible describe extra parameters by using the @@In@@ decorator over the method. +It's possible to describe extra parameters by using the @@In@@ decorator over the method. <<< @/tutorials/snippets/scalar/endpoint-extra-in-params.ts diff --git a/docs/tutorials/swagger.md b/docs/tutorials/swagger.md index b03c3b664f8..42b855ee58f 100644 --- a/docs/tutorials/swagger.md +++ b/docs/tutorials/swagger.md @@ -11,8 +11,8 @@ meta: This page shows you how you can configure Swagger-ui with Ts.ED. Swagger uses the OpenApi -to describe a Rest API. Ts.ED operates the existing decorators to build -a spec compliant with Swagger. +to describe a Rest API. Ts.ED uses existing decorators to build +a specification compliant with Swagger. ## Installation @@ -140,7 +140,7 @@ export class Server {} ## Model documentation -One of the feature of Ts.ED is the model definition to serialize or deserialize a +One of the features of Ts.ED is the model definition to serialize or deserialize a JSON Object based on JsonSchema (See [model documentation](/docs/model.md)). A model can be used on a method controller along with @@BodyParams@@ or other decorators. @@ -156,7 +156,7 @@ This example shows you how to use the decorators to generate swagger documentati ## Extra parameters Sometimes you want to display extra `in` parameters like `headers` without consuming it in an endpoint. -It's possible describe extra parameters by using the @@In@@ decorator over the method. +It's possible to describe extra parameters by using the @@In@@ decorator over the method. <<< @/tutorials/snippets/swagger/endpoint-extra-in-params.ts diff --git a/packages/core/tsconfig.spec.json b/packages/core/tsconfig.spec.json index 58185f4b5a3..d962148c0d9 100644 --- a/packages/core/tsconfig.spec.json +++ b/packages/core/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http": ["../platform/platform-http/src/common/index.ts"], "@tsed/ajv": ["../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform/platform-express/src/index.ts"], diff --git a/packages/di/tsconfig.spec.json b/packages/di/tsconfig.spec.json index f6eda41018e..b5149b19c61 100644 --- a/packages/di/tsconfig.spec.json +++ b/packages/di/tsconfig.spec.json @@ -23,6 +23,7 @@ "@tsed/platform-http": ["../platform/platform-http/src/common/index.ts"], "@tsed/ajv": ["../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform/platform-express/src/index.ts"], diff --git a/packages/engines/tsconfig.spec.json b/packages/engines/tsconfig.spec.json index 58185f4b5a3..d962148c0d9 100644 --- a/packages/engines/tsconfig.spec.json +++ b/packages/engines/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http": ["../platform/platform-http/src/common/index.ts"], "@tsed/ajv": ["../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform/platform-express/src/index.ts"], diff --git a/packages/graphql/apollo/tsconfig.spec.json b/packages/graphql/apollo/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/graphql/apollo/tsconfig.spec.json +++ b/packages/graphql/apollo/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/graphql/typegraphql/tsconfig.spec.json b/packages/graphql/typegraphql/tsconfig.spec.json index 9140b8f2bfe..9ef43fbfb86 100644 --- a/packages/graphql/typegraphql/tsconfig.spec.json +++ b/packages/graphql/typegraphql/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/orm/adapters-redis/tsconfig.spec.json b/packages/orm/adapters-redis/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/orm/adapters-redis/tsconfig.spec.json +++ b/packages/orm/adapters-redis/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/orm/adapters/tsconfig.spec.json b/packages/orm/adapters/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/orm/adapters/tsconfig.spec.json +++ b/packages/orm/adapters/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/orm/ioredis/tsconfig.spec.json b/packages/orm/ioredis/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/orm/ioredis/tsconfig.spec.json +++ b/packages/orm/ioredis/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/orm/mikro-orm/tsconfig.spec.json b/packages/orm/mikro-orm/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/orm/mikro-orm/tsconfig.spec.json +++ b/packages/orm/mikro-orm/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/orm/mongoose/tsconfig.spec.json b/packages/orm/mongoose/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/orm/mongoose/tsconfig.spec.json +++ b/packages/orm/mongoose/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/orm/objection/tsconfig.spec.json b/packages/orm/objection/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/orm/objection/tsconfig.spec.json +++ b/packages/orm/objection/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/orm/prisma/tsconfig.spec.json b/packages/orm/prisma/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/orm/prisma/tsconfig.spec.json +++ b/packages/orm/prisma/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/platform/common/tsconfig.spec.json b/packages/platform/common/tsconfig.spec.json index 26917788031..61bc2a78a1b 100644 --- a/packages/platform/common/tsconfig.spec.json +++ b/packages/platform/common/tsconfig.spec.json @@ -23,6 +23,7 @@ "@tsed/components-scan": ["../../third-parties/components-scan/src/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-cache/tsconfig.spec.json b/packages/platform/platform-cache/tsconfig.spec.json index bfb3bb5dd8e..7106e3527eb 100644 --- a/packages/platform/platform-cache/tsconfig.spec.json +++ b/packages/platform/platform-cache/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http": ["../../platform/platform-http/src/common/index.ts"], "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-exceptions/tsconfig.spec.json b/packages/platform/platform-exceptions/tsconfig.spec.json index 5042f527b11..365e806b5d8 100644 --- a/packages/platform/platform-exceptions/tsconfig.spec.json +++ b/packages/platform/platform-exceptions/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-express/tsconfig.spec.json b/packages/platform/platform-express/tsconfig.spec.json index 5c0579f1d86..76c217dea2b 100644 --- a/packages/platform/platform-express/tsconfig.spec.json +++ b/packages/platform/platform-express/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-koa": ["../platform-koa/src/index.ts"] diff --git a/packages/platform/platform-http/tsconfig.spec.json b/packages/platform/platform-http/tsconfig.spec.json index fab48ebe865..2677b5accec 100644 --- a/packages/platform/platform-http/tsconfig.spec.json +++ b/packages/platform/platform-http/tsconfig.spec.json @@ -23,6 +23,7 @@ "@tsed/components-scan": ["../../third-parties/components-scan/src/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-koa/tsconfig.spec.json b/packages/platform/platform-koa/tsconfig.spec.json index 8dcd69241d7..2a23b5e93f7 100644 --- a/packages/platform/platform-koa/tsconfig.spec.json +++ b/packages/platform/platform-koa/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"] diff --git a/packages/platform/platform-log-middleware/tsconfig.spec.json b/packages/platform/platform-log-middleware/tsconfig.spec.json index 4a39ef8c990..d7d2e5ca303 100644 --- a/packages/platform/platform-log-middleware/tsconfig.spec.json +++ b/packages/platform/platform-log-middleware/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-log-request/tsconfig.spec.json b/packages/platform/platform-log-request/tsconfig.spec.json index cfc2ea29b33..446d2f8a798 100644 --- a/packages/platform/platform-log-request/tsconfig.spec.json +++ b/packages/platform/platform-log-request/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-middlewares/tsconfig.spec.json b/packages/platform/platform-middlewares/tsconfig.spec.json index 20d17672904..e87230cfd52 100644 --- a/packages/platform/platform-middlewares/tsconfig.spec.json +++ b/packages/platform/platform-middlewares/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-params/tsconfig.spec.json b/packages/platform/platform-params/tsconfig.spec.json index fd0decd0683..39a6b6bb7c9 100644 --- a/packages/platform/platform-params/tsconfig.spec.json +++ b/packages/platform/platform-params/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-response-filter/tsconfig.spec.json b/packages/platform/platform-response-filter/tsconfig.spec.json index fe6d630cd4e..c71f524e58f 100644 --- a/packages/platform/platform-response-filter/tsconfig.spec.json +++ b/packages/platform/platform-response-filter/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-router/tsconfig.spec.json b/packages/platform/platform-router/tsconfig.spec.json index 49e55e83b94..b2cfeb6c9d3 100644 --- a/packages/platform/platform-router/tsconfig.spec.json +++ b/packages/platform/platform-router/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-serverless-http/tsconfig.spec.json b/packages/platform/platform-serverless-http/tsconfig.spec.json index 27af37afa76..645538aa348 100644 --- a/packages/platform/platform-serverless-http/tsconfig.spec.json +++ b/packages/platform/platform-serverless-http/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-serverless/tsconfig.spec.json b/packages/platform/platform-serverless/tsconfig.spec.json index 27af37afa76..645538aa348 100644 --- a/packages/platform/platform-serverless/tsconfig.spec.json +++ b/packages/platform/platform-serverless/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/platform/platform-views/tsconfig.spec.json b/packages/platform/platform-views/tsconfig.spec.json index 93e15ab6ad0..9cc07ae79ac 100644 --- a/packages/platform/platform-views/tsconfig.spec.json +++ b/packages/platform/platform-views/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../platform-express/src/index.ts"], diff --git a/packages/security/jwks/tsconfig.spec.json b/packages/security/jwks/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/security/jwks/tsconfig.spec.json +++ b/packages/security/jwks/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/security/oidc-provider-plugin-wildcard-redirect-uri/tsconfig.spec.json b/packages/security/oidc-provider-plugin-wildcard-redirect-uri/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/security/oidc-provider-plugin-wildcard-redirect-uri/tsconfig.spec.json +++ b/packages/security/oidc-provider-plugin-wildcard-redirect-uri/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/security/oidc-provider/tsconfig.spec.json b/packages/security/oidc-provider/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/security/oidc-provider/tsconfig.spec.json +++ b/packages/security/oidc-provider/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/security/passport/tsconfig.spec.json b/packages/security/passport/tsconfig.spec.json index 26110503c79..36096534371 100644 --- a/packages/security/passport/tsconfig.spec.json +++ b/packages/security/passport/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/specs/ajv/tsconfig.spec.json b/packages/specs/ajv/tsconfig.spec.json index e7de584d2cf..8cbe0a4923c 100644 --- a/packages/specs/ajv/tsconfig.spec.json +++ b/packages/specs/ajv/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http": ["../../platform/platform-http/src/common/index.ts"], "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/specs/exceptions/tsconfig.spec.json b/packages/specs/exceptions/tsconfig.spec.json index a4139f2d4e7..4ee000aad28 100644 --- a/packages/specs/exceptions/tsconfig.spec.json +++ b/packages/specs/exceptions/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/specs/json-mapper/tsconfig.spec.json b/packages/specs/json-mapper/tsconfig.spec.json index b554cf3929f..b7bdb41583e 100644 --- a/packages/specs/json-mapper/tsconfig.spec.json +++ b/packages/specs/json-mapper/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/specs/openapi-utils/src/services/OpenAPIBaseModule.ts b/packages/specs/openapi-utils/src/services/OpenAPIBaseModule.ts index ad032685b7b..1762e1597b5 100644 --- a/packages/specs/openapi-utils/src/services/OpenAPIBaseModule.ts +++ b/packages/specs/openapi-utils/src/services/OpenAPIBaseModule.ts @@ -6,12 +6,12 @@ import {normalizePath} from "@tsed/normalize-path"; import {application, OnReady, OnRoutesInit} from "@tsed/platform-http"; import {PlatformRouter, useContextHandler} from "@tsed/platform-router"; -import {OpenAPIService} from "../.."; import type {OpenApiSettings} from "../interfaces/OpenApiSettings.js"; import {cssMiddleware} from "../middlewares/cssMiddleware.js"; import {jsMiddleware} from "../middlewares/jsMiddleware.js"; import {openApiMiddleware} from "../middlewares/openApiMiddleware.js"; import {redirectMiddleware} from "../middlewares/redirectMiddleware.js"; +import {OpenAPIService} from "../services/OpenAPIService.js"; export abstract class OpenAPIBaseModule implements OnRoutesInit, OnReady { abstract name: string; diff --git a/packages/specs/scalar/.npmignore b/packages/specs/scalar/.npmignore new file mode 100644 index 00000000000..0887e21d43e --- /dev/null +++ b/packages/specs/scalar/.npmignore @@ -0,0 +1,7 @@ +test +coverage +tsconfig.json +tsconfig.*.json +__mock__ +*.spec.js +*.tsbuildinfo diff --git a/packages/specs/scalar/package.json b/packages/specs/scalar/package.json new file mode 100644 index 00000000000..c757127e425 --- /dev/null +++ b/packages/specs/scalar/package.json @@ -0,0 +1,57 @@ +{ + "name": "@tsed/scalar", + "description": "Scalar package for Ts.ED framework", + "type": "module", + "version": "8.2.0", + "source": "./src/index.ts", + "main": "./lib/esm/index.js", + "module": "./lib/esm/index.js", + "typings": "./lib/types/index.d.ts", + "exports": { + ".": { + "@tsed/source": "./src/index.ts", + "types": "./lib/types/index.d.ts", + "import": "./lib/esm/index.js", + "default": "./lib/esm/index.js" + } + }, + "scripts": { + "clean": "rm -rf lib", + "build": "yarn clean && yarn barrels && yarn build:ts && yarn copy:views", + "copy:views": "cp -r ./views ./lib/views", + "barrels": "barrels", + "test": "vitest run", + "start": "node --import @swc-node/register/esm-register test/app/index.ts", + "build:ts": "tsc --build tsconfig.json", + "test:ci": "vitest run --coverage.thresholds.autoUpdate=true" + }, + "dependencies": { + "@scalar/types": "^0.0.23", + "@tsed/normalize-path": "workspace:*", + "@tsed/openapi-utils": "workspace:*", + "@tsed/openspec": "workspace:*", + "tslib": "2.7.0" + }, + "devDependencies": { + "@tsed/barrels": "workspace:*", + "@tsed/core": "workspace:*", + "@tsed/di": "workspace:*", + "@tsed/json-mapper": "workspace:*", + "@tsed/openspec": "workspace:*", + "@tsed/platform-http": "workspace:*", + "@tsed/schema": "workspace:*", + "@tsed/swagger": "workspace:*", + "@tsed/typescript": "workspace:*", + "eslint": "9.12.0", + "typescript": "5.4.5", + "vitest": "2.1.2" + }, + "peerDependencies": { + "@tsed/platform-http": "8.2.0" + }, + "peerDependenciesMeta": { + "@tsed/platform-http": { + "optional": false + } + } +} diff --git a/packages/specs/scalar/readme.md b/packages/specs/scalar/readme.md new file mode 100644 index 00000000000..2102a55f025 --- /dev/null +++ b/packages/specs/scalar/readme.md @@ -0,0 +1,214 @@ +

+ Ts.ED logo +

+ +
+

Scalar

+ +[![Build & Release](https://github.com/tsedio/tsed/workflows/Build%20&%20Release/badge.svg)](https://github.com/tsedio/tsed/actions?query=workflow%3A%22Build+%26+Release%22) +[![PR Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/tsedio/tsed/blob/master/CONTRIBUTING.md) +[![npm version](https://badge.fury.io/js/%40tsed%2Fcommon.svg)](https://badge.fury.io/js/%40tsed%2Fcommon) +[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) +[![github](https://img.shields.io/static/v1?label=Github%20sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/romakita) +[![opencollective](https://img.shields.io/static/v1?label=OpenCollective%20sponsor&message=%E2%9D%A4&logo=OpenCollective&color=%23fe8e86)](https://opencollective.com/tsed) + +
+ +
+ Website +   •   + Getting started +   •   + Slack +   •   + Twitter +
+ +
+ +A package of Ts.ED framework. See website: https://tsed.io/#/tutorials/scalar + +## Installation + +```bash +npm install --save @tsed/scalar +``` + +Then add the following configuration in your Server: + +```typescript +import {Configuration} from "@tsed/di"; +import "@tsed/scalar"; // import scalar Ts.ED module +import {resolve} from "path"; + +@Configuration({ + scalar: [ + { + path: "/v3/docs", + specVersion: "3.0.1" + } + ] +}) +export class Server {} +``` + +> The path option for swagger will be used to expose the documentation (ex: http://localhost:8000/docs). + +Normally, Swagger-ui is ready. You can start your server and check if it work fine. + +> Note: Ts.ED will print the swagger url in the console. + +### Swagger options + +Some options is available to configure Swagger-ui, Ts.ED and the default spec information. + +| Key | Example | Description | +| -------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| path | `/api-doc` | The url subpath to access to the documentation. | +| specVersion | `3.0.1` | The spec version. | +| doc | `hidden-doc` | The documentation key used by `@Docs` decorator to create several swagger documentations. | +| cssPath | `${rootDir}/spec/style.css` | The path to the CSS file. | +| spec | `{"openapi": "3.0.1"}` | The default information spec. | +| hidden | `true` | Hide the documentation in the dropdown explorer list. | +| options | Scalar options | SwaggerUI options. See (https://github.com/swagger-api/swagger-ui/blob/HEAD/docs/usage/configuration.md) | +| operationIdFormatter | `(name: string, propertyKey: string, path: string) => string` | A function to generate the operationId. | +| operationIdPattern | `%c_%m` | A pattern to generate the operationId. Format of operationId field (%c: class name, %m: method name). | + +### Multi documentations + +It also possible to create several swagger documentations with `doc` option: + +```typescript +import {Configuration} from "@tsed/di"; +import "@tsed/scalar"; // import swagger Ts.ED module + +@Configuration({ + scalar: [ + { + path: "/api-docs-v1", + doc: "api-v1" + }, + { + path: "/api-docs-v2", + doc: "api-v2" + } + ] +}) +export class Server {} +``` + +Then use `@Docs` decorators on your controllers to specify where the controllers should be displayed. + +```typescript +import {Controller} from "@tsed/di"; +import {Docs} from "@tsed/swagger"; + +@Controller("/calendars") +@Docs("api-v2") // display this controllers only for api-docs-v2 +export class CalendarCtrlV2 {} +// OR +@Controller("/calendars") +@Docs("api-v2", "api-v1") // display this controllers for api-docs-v2 and api-docs-v1 +export class CalendarCtrl {} +``` + +## Examples + +#### Model documentation + +One of the feature of Ts.ED is the model definition to serialize or deserialize a +JSON Object (see [converters section](https://tsed.io/docs/components/converters.html)). + +This model can used on a method controller along with [@BodyParams](https://tsed.io/api/common/filters/decorators/BodyParams.html) or other decorators. + +```typescript +import {JsonProperty, Title, Description, Example} from "@tsed/schema"; + +export class CalendarModel { + @Title("iD") + @Description("Description of calendar model id") + @Example("Example value") + @JsonProperty() + public id: string; + + @JsonProperty() + public name: string; +} +``` + +#### Endpoint documentation + +```typescript +import {Controller} from "@tsed/di"; +import {BodyParams, QueryParams} from "@tsed/platform-params"; +import {Get, Post, Returns, ReturnsArray, Description, Summary, Deprecated, Security} from "@tsed/schema"; +import {CalendarModel} from "../models/CalendarModel.js"; + +@Controller("/calendars") +export class Calendar { + @Get("/:id") + @Summary("Summary of this route") + @Description("Description of this route") + @Returns(CalendarModel) + @Returns(404, {description: "Not found"}) + async getCalendar(@QueryParams("id") id: string): Promise { + //... + } + + @Get("/v0/:id") + @Deprecated() + @Description("Deprecated route, use /rest/calendars/:id instead of.") + @Returns(CalendarModel) + @Returns(404, {description: "Not found"}) + getCalendarDeprecated(@QueryParams("id") id: string): Promise { + //... + } + + @Get("/") + @Description("Description of this route") + @ReturnsArray(CalendarModel) + getCalendars(): Promise { + // ... + } + + @Post("/") + @Security("calendar_auth", "write:calendar", "read:calendar") + @Returns(CalendarModel) + async createCalendar(@BodyParams() body: any): Promise { + //... + } +} +``` + +## Documentation + +See our documentation https://tsed.io/#/api/index + +## Contributors + +Please read [contributing guidelines here](https://tsed.io/contributing.html). + + + +## Backers + +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)] + + + +## Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)] + +## License + +The MIT License (MIT) + +Copyright (c) 2016 - 2022 Romain Lenzotti + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/specs/scalar/src/ScalarModule.spec.ts b/packages/specs/scalar/src/ScalarModule.spec.ts new file mode 100644 index 00000000000..14c422b2978 --- /dev/null +++ b/packages/specs/scalar/src/ScalarModule.spec.ts @@ -0,0 +1,60 @@ +import {logger} from "@tsed/di"; +import {application} from "@tsed/platform-http"; +import {PlatformTest} from "@tsed/platform-http/testing"; +import {PlatformRouter} from "@tsed/platform-router"; + +import {ScalarModule} from "./ScalarModule.js"; + +vi.mock("node:fs/promises"); + +describe("SwaggerModule", () => { + beforeEach(() => + PlatformTest.create({ + httpPort: 8080, + httpsPort: 8081, + scalar: [ + { + path: "/doc", + cssPath: "/cssPath/style.css", + jsPath: "/jsPath/script.js", + viewPath: "/viewsPath", + outFile: "/openapi.json" + } + ] + }) + ); + afterEach(PlatformTest.reset); + + describe("$onRoutesInit", () => { + it("should add middlewares", async () => { + const mod = await PlatformTest.invoke(ScalarModule); + + vi.spyOn(application(), "get").mockReturnValue(undefined as never); + vi.spyOn(application(), "use").mockReturnValue(undefined as never); + vi.spyOn(PlatformRouter.prototype as any, "get").mockReturnValue(undefined); + vi.spyOn(PlatformRouter.prototype as any, "statics").mockReturnValue(undefined); + + mod.$onRoutesInit(); + mod.$onRoutesInit(); + + expect(application().use).toHaveBeenCalledWith("/doc", expect.any(Function)); + expect(application().use).toHaveBeenCalledWith("/doc", expect.any(PlatformRouter)); + expect(PlatformRouter.prototype.get).toHaveBeenCalledWith("/openapi.json", expect.any(Function)); + expect(PlatformRouter.prototype.get).toHaveBeenCalledWith("/style.css", expect.any(Function)); + expect(PlatformRouter.prototype.get).toHaveBeenCalledWith("/script.js", expect.any(Function)); + }); + }); + + describe("$onReady", () => { + it("should display the right log", async () => { + const mod = await PlatformTest.invoke(ScalarModule); + + vi.spyOn(logger(), "info"); + + mod.$onReady(); + + expect(logger().info).toHaveBeenCalledWith("[default] OpenAPI JSON is available on https://0.0.0.0:8081/doc/openapi.json"); + expect(logger().info).toHaveBeenCalledWith("[default] Scalar UI is available on https://0.0.0.0:8081/doc/"); + }); + }); +}); diff --git a/packages/specs/scalar/src/ScalarModule.ts b/packages/specs/scalar/src/ScalarModule.ts new file mode 100644 index 00000000000..d54c826d4e4 --- /dev/null +++ b/packages/specs/scalar/src/ScalarModule.ts @@ -0,0 +1,46 @@ +import {join} from "node:path"; + +import {constant, injectable, ProviderType} from "@tsed/di"; +import {OpenAPIBaseModule} from "@tsed/openapi-utils"; +import {useContextHandler} from "@tsed/platform-router"; + +import {ROOT_DIR} from "./constants.js"; +import {ScalarSettings} from "./interfaces/ScalarSettings.js"; +import {indexMiddleware} from "./middlewares/indexMiddleware.js"; + +export class ScalarModule extends OpenAPIBaseModule { + readonly name = "Scalar"; + readonly rootDir = ROOT_DIR; + + get settings() { + const settings = constant("scalar", []).filter((o) => !!o); + + return settings.map((conf) => { + return Object.assign( + { + disableSpec: false, + _integration: "tsed", + cdn: "https://cdn.jsdelivr.net/npm/@scalar/api-reference", + path: "/", + fileName: "openapi.json", + cssPath: join(ROOT_DIR, "views/assets/scalar.css"), + viewPath: join(ROOT_DIR, "views/scalar.ejs") + }, + conf + ); + }); + } + + protected createRouter(conf: ScalarSettings) { + const {viewPath} = conf; + const router = super.createRouter(conf); + + if (viewPath) { + router.get("/", useContextHandler(indexMiddleware(viewPath, conf))); + } + + return router; + } +} + +injectable(ScalarModule).type(ProviderType.MODULE); diff --git a/packages/specs/scalar/src/constants.ts b/packages/specs/scalar/src/constants.ts new file mode 100644 index 00000000000..e10e6d782c4 --- /dev/null +++ b/packages/specs/scalar/src/constants.ts @@ -0,0 +1,3 @@ +import {join} from "path"; + +export const ROOT_DIR = join(import.meta.dirname, ".."); diff --git a/packages/specs/scalar/src/exports.ts b/packages/specs/scalar/src/exports.ts new file mode 100644 index 00000000000..255ec326e8b --- /dev/null +++ b/packages/specs/scalar/src/exports.ts @@ -0,0 +1 @@ +export {Docs} from "@tsed/openapi-utils"; diff --git a/packages/specs/scalar/src/index.ts b/packages/specs/scalar/src/index.ts new file mode 100644 index 00000000000..75dc0a44574 --- /dev/null +++ b/packages/specs/scalar/src/index.ts @@ -0,0 +1,8 @@ +/** + * @file Automatically generated by @tsed/barrels. + */ +export * from "./constants.js"; +export * from "./exports.js"; +export * from "./interfaces/ScalarSettings.js"; +export * from "./middlewares/indexMiddleware.js"; +export * from "./ScalarModule.js"; diff --git a/packages/specs/scalar/src/interfaces/ScalarSettings.ts b/packages/specs/scalar/src/interfaces/ScalarSettings.ts new file mode 100644 index 00000000000..f2ae87eab4e --- /dev/null +++ b/packages/specs/scalar/src/interfaces/ScalarSettings.ts @@ -0,0 +1,9 @@ +// @ts-ignore +import type {ReferenceConfiguration} from "@scalar/types/legacy"; +import type {OpenApiSettings} from "@tsed/openapi-utils"; + +export type ScalarSettings = OpenApiSettings & + ReferenceConfiguration & { + cdn?: string; + options?: ReferenceConfiguration; + }; diff --git a/packages/specs/scalar/src/middlewares/indexMiddleware.ts b/packages/specs/scalar/src/middlewares/indexMiddleware.ts new file mode 100644 index 00000000000..5cb465a1f50 --- /dev/null +++ b/packages/specs/scalar/src/middlewares/indexMiddleware.ts @@ -0,0 +1,30 @@ +import {basename} from "node:path"; + +import {context} from "@tsed/di"; +import {join} from "path"; + +import {ScalarSettings} from "../interfaces/ScalarSettings.js"; + +export function indexMiddleware(viewPath: string, conf: ScalarSettings) { + return async () => { + const ctx = context(); + const {path, options = {}, cssPath, cdn, fileName} = conf; + + const opts = { + _integration: "tsed", + spec: { + url: `${path}/${fileName}` + }, + ...options + }; + + ctx.response.body( + await ctx.response.render(viewPath, { + cssPath: join(path, basename(cssPath)), + cdn, + serializedOptions: JSON.stringify(opts).split('"').join("""), + options: opts + }) + ); + }; +} diff --git a/packages/specs/scalar/test/__snapshots__/scalar.integration.spec.ts.snap b/packages/specs/scalar/test/__snapshots__/scalar.integration.spec.ts.snap new file mode 100644 index 00000000000..7b009a7409c --- /dev/null +++ b/packages/specs/scalar/test/__snapshots__/scalar.integration.spec.ts.snap @@ -0,0 +1,143 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Swagger integration > OpenSpec3 > should swagger spec 1`] = ` +{ + "components": { + "schemas": { + "Calendar": { + "properties": { + "id": { + "type": "string", + }, + "name": { + "minLength": 1, + "type": "string", + }, + }, + "required": [ + "name", + ], + "type": "object", + }, + }, + }, + "info": { + "title": "Api documentation", + "version": "1.0.0", + }, + "openapi": "3.0.1", + "paths": { + "/rest/calendars": { + "get": { + "operationId": "calendarsControllerGetAll", + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "items": { + "$ref": "#/components/schemas/Calendar", + }, + "type": "array", + }, + }, + }, + "description": "Success", + }, + }, + "tags": [ + "CalendarsController", + ], + }, + }, + "/rest/calendars/csv": { + "post": { + "operationId": "calendarsControllerCsv", + "parameters": [], + "requestBody": { + "content": { + "text/plain": { + "schema": { + "type": "string", + }, + }, + }, + "required": false, + }, + "responses": { + "200": { + "content": { + "text/plain": { + "schema": { + "type": "string", + }, + }, + }, + "description": "Success", + }, + }, + "tags": [ + "CalendarsController", + ], + }, + }, + "/rest/calendars/events": { + "get": { + "description": "Events", + "operationId": "eventCtrlGet", + "parameters": [], + "responses": { + "200": { + "description": "Success", + }, + }, + "tags": [ + "EventCtrl", + ], + }, + }, + "/rest/calendars/{id}": { + "get": { + "operationId": "calendarsControllerGet", + "parameters": [ + { + "description": "An ObjectID", + "in": "path", + "name": "id", + "required": true, + "schema": { + "example": "5ce7ad3028890bd71749d477", + "pattern": "^[0-9a-fA-F]{24}$", + "type": "string", + }, + }, + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Calendar", + }, + }, + }, + "description": "Success", + }, + }, + "tags": [ + "CalendarsController", + ], + }, + }, + }, + "tags": [ + { + "name": "CalendarsController", + }, + { + "name": "EventCtrl", + }, + ], +} +`; diff --git a/packages/specs/scalar/test/app/Server.ts b/packages/specs/scalar/test/app/Server.ts new file mode 100644 index 00000000000..000ad958564 --- /dev/null +++ b/packages/specs/scalar/test/app/Server.ts @@ -0,0 +1,40 @@ +import "@tsed/platform-express"; +import "../../src/index.js"; + +import {Configuration, Inject} from "@tsed/di"; +import {PlatformApplication} from "@tsed/platform-http"; +import bodyParser from "body-parser"; +import compress from "compression"; +import cookieParser from "cookie-parser"; +import methodOverride from "method-override"; + +const rootDir = import.meta.dirname; // automatically replaced by import.meta.dirname on build + +@Configuration({ + rootDir, + port: 8001, + disableComponentScan: true, + scalar: [ + { + path: "/doc", + specVersion: "3.0.1" + } + ] +}) +export class Server { + @Inject() + app: PlatformApplication; + + public $beforeRoutesInit(): void { + this.app + .use(bodyParser.json()) + .use( + bodyParser.urlencoded({ + extended: true + }) + ) + .use(cookieParser()) + .use(compress({})) + .use(methodOverride()); + } +} diff --git a/packages/specs/scalar/test/app/class/classes.ts b/packages/specs/scalar/test/app/class/classes.ts new file mode 100644 index 00000000000..4dd25227c20 --- /dev/null +++ b/packages/specs/scalar/test/app/class/classes.ts @@ -0,0 +1,114 @@ +import {Any, CollectionOf, Description, Example, Name, Property, Required, Title} from "@tsed/schema"; + +export class SwaNoDecoModel { + public prop: string; +} + +export class SwaBaseModel { + @Title("id") + @Description("Unique identifier.") + @Property() + public id?: string; +} + +export class SwaNameModel extends SwaBaseModel { + @Title("name") + @Description("The name") + @Property() + public name: string; +} + +export class SwaAgeModel extends SwaBaseModel { + @Title("age") + @Description("The age") + @Property() + public age: number; +} + +export class SwaFoo { + @Title("SwaFoo.test") + @Description("Description.test") + test: any; + + @Title("SwaFoo.foo") + @Description("Description.foo") + foo: any; + + method() {} +} + +@Title("SwaFoo2") +@Description("Description Class") +export class SwaFoo2 { + @Title("Test") + @Description("Description test") + @Property() + @Required() + test: string = ""; + + @Name("Name") + name: string; + + @Property() + dateStart: Date; + + @Property() + uint: number; + + object: any; + + @Property() + foo: SwaFoo; + + @CollectionOf(SwaFoo) + @Title("SwaFoo2.foos") + @Description("SwaFoo2.foos description") + @Example("TODO") + foos: SwaFoo[]; + + @Title("SwaFoo2.theMap") + @Description("SwaFoo2.theMap description") + @CollectionOf(SwaFoo) + theMap: Map; + + @Title("SwaFoo2.theSet") + @Description("SwaFoo2.theSet description") + @Property(SwaFoo) + theSet: Set; + + @Property(String) + mapOfString: Map; + + @Property(String) + arrayOfString: string[]; + + @Property() + nameModel: SwaNameModel; + + @Property() + ageModel: SwaAgeModel; + + @Any() + mapAny: Map; + @Any() + anyValue: any; + + method() {} +} + +export class Ctrl {} + +export class ParentModel { + @Required() + parentProperty: string; +} + +export class ChildModelA extends ParentModel { + @Required() + childPropertyA: string; +} + +export class ChildModelB extends ParentModel { + @Required() + childPropertyB: string; +} diff --git a/packages/specs/scalar/test/app/index.ts b/packages/specs/scalar/test/app/index.ts new file mode 100644 index 00000000000..a6ef9dec769 --- /dev/null +++ b/packages/specs/scalar/test/app/index.ts @@ -0,0 +1,125 @@ +import {Controller} from "@tsed/di"; +import {$log} from "@tsed/logger"; +import {PlatformExpress} from "@tsed/platform-express"; +import {BodyParams, PathParams, QueryParams} from "@tsed/platform-params"; +import {DiscriminatorKey, DiscriminatorValue, Get, Hidden, OneOf, Post, Property, Put, Required, Returns} from "@tsed/schema"; + +import {Server} from "./Server.js"; + +if (process.env.NODE_ENV !== "test") { + class QueryModel { + @Property() + condition: string; + + @Property() + value: string; + } + + @Controller("/nested") + class HelloWorld3 { + @Get("/") + get() { + return {test: "Hello world"}; + } + } + + @Controller({ + path: "/hello", + children: [HelloWorld3] + }) + class HelloWorld { + @Get("/") + get() { + return {test: "Hello world"}; + } + + @Get("/hidden") + @Hidden() + getHidden() { + return {test: "Hello world"}; + } + + @Get("/params") + getQuery(@QueryParams("q") q: QueryModel) { + return {test: "Hello world", q}; + } + } + + @Controller("/hello2") + @Hidden() + class HelloWorld2 { + @Get("/") + get() { + return {test: "Hello world"}; + } + } + + class Event { + @DiscriminatorKey() // declare this property a discriminator key + type: string; + + @Property() + value: string; + } + + @DiscriminatorValue("page_view") // or @DiscriminatorValue() value can be inferred by the class name + class PageView extends Event { + @Required() + url: string; + } + + @DiscriminatorValue("action", "click_action") + class Action extends Event { + @Required() + event: string; + } + + @DiscriminatorValue() + class CustomAction extends Event { + @Required() + event: string; + + @Property() + meta: string; + } + + type OneOfEvents = PageView | Action | CustomAction; + + @Controller("/one-of") + class HelloOneOf { + @Post("/") + @(Returns(200, Array).OneOf(Event)) + post(@BodyParams() @OneOf(Event) events: OneOfEvents[]) { + return []; + } + + @Put("/:id") + @(Returns(200).OneOf(Event)) + put(@PathParams(":id") id: string, @BodyParams() @OneOf(Event) event: OneOfEvents) { + return []; + } + + @Get("/:id") + @(Returns(200).OneOf(Event)) + get(@PathParams(":id") id: string) { + return []; + } + } + + async function bootstrap() { + try { + $log.debug("Start server..."); + const platform = await PlatformExpress.bootstrap(Server, { + mount: {"/rest": [HelloWorld, HelloWorld2, HelloOneOf]} + }); + + await platform.listen(); + $log.debug("Server initialized"); + } catch (er) { + console.error(er); + $log.error(er); + } + } + + bootstrap(); +} diff --git a/packages/specs/scalar/test/app/models/Calendar.ts b/packages/specs/scalar/test/app/models/Calendar.ts new file mode 100644 index 00000000000..6f43c11ff53 --- /dev/null +++ b/packages/specs/scalar/test/app/models/Calendar.ts @@ -0,0 +1,14 @@ +import {Name, Required} from "@tsed/schema"; + +export class Calendar { + @Name("id") + id: string; + + @Required() + name: string; + + constructor({id, name}: any = {}) { + this.id = id; + this.name = name; + } +} diff --git a/packages/specs/scalar/test/scalar.integration.spec.ts b/packages/specs/scalar/test/scalar.integration.spec.ts new file mode 100644 index 00000000000..6d4459e2399 --- /dev/null +++ b/packages/specs/scalar/test/scalar.integration.spec.ts @@ -0,0 +1,99 @@ +import {Controller} from "@tsed/di"; +import {ObjectID} from "@tsed/mongoose"; +import {Docs} from "@tsed/openapi-utils"; +import {PlatformExpress} from "@tsed/platform-express"; +import {PlatformTest} from "@tsed/platform-http/testing"; +import {BodyParams, PathParams} from "@tsed/platform-params"; +import {Consumes, Description, Get, Hidden, Post, Returns} from "@tsed/schema"; +import SuperTest from "supertest"; + +import {Calendar} from "./app/models/Calendar.js"; +import {Server} from "./app/Server.js"; + +@Controller("/admin") +@Hidden() +class AdminCtrl { + @Get("/") + get() {} +} + +@Controller("/events") +class EventCtrl { + @Get("/") + @Description("Events") + get() {} +} + +@Controller("/admin") +@Docs("admin") +class BackAdminCtrl { + @Get("/") + @Description("Admins") + get() {} +} + +@Controller({ + path: "/calendars", + children: [AdminCtrl, EventCtrl] +}) +class CalendarsController { + @Get("/:id") + @Returns(200, Calendar) + get(@PathParams("id") @ObjectID() id: string): Promise { + return Promise.resolve(new Calendar({id, name: "test"})); + } + + @Get("/") + @(Returns(200, Array).Of(Calendar)) + getAll(): Promise { + return Promise.resolve([new Calendar({id: 1, name: "name"}), new Calendar({id: 2, name: "name"})]); + } + + @Post("/csv") + @Consumes("text/plain") + @(Returns(200, String).ContentType("text/plain")) + csv(@BodyParams() csvLines: string): Promise { + return Promise.resolve(""); + } + + @Get("/hidden") + @Hidden() + @Description("Admins") + getHidden() {} +} + +describe("Swagger integration", () => { + describe("OpenSpec3", () => { + let request: SuperTest.Agent; + beforeEach( + PlatformTest.bootstrap(Server, { + adapter: PlatformExpress, + mount: { + "/rest": [CalendarsController] + } + }) + ); + beforeEach(() => { + request = SuperTest(PlatformTest.callback()); + }); + afterEach(PlatformTest.reset); + + it("should swagger spec", async () => { + const response = await request.get("/doc/openapi.json").expect(200); + const result = await request.get("/rest/calendars").expect(200); + + expect(result.body).toEqual([ + { + id: "1", + name: "name" + }, + { + id: "2", + name: "name" + } + ]); + + expect(response.body).toMatchSnapshot(); + }); + }); +}); diff --git a/packages/specs/scalar/tsconfig.esm.json b/packages/specs/scalar/tsconfig.esm.json new file mode 100644 index 00000000000..8954049da4a --- /dev/null +++ b/packages/specs/scalar/tsconfig.esm.json @@ -0,0 +1,26 @@ +{ + "extends": "@tsed/typescript/tsconfig.node.json", + "compilerOptions": { + "baseUrl": ".", + "rootDir": "src", + "outDir": "./lib/esm", + "declarationDir": "./lib/types", + "declaration": true, + "composite": true, + "noEmit": false + }, + "include": ["src/**/*.ts", "src/**/*.json"], + "exclude": [ + "node_modules", + "test", + "lib", + "benchmark", + "coverage", + "spec", + "**/*.benchmark.ts", + "**/*.spec.ts", + "keys", + "**/__mock__/**", + "webpack.config.js" + ] +} diff --git a/packages/specs/scalar/tsconfig.json b/packages/specs/scalar/tsconfig.json new file mode 100644 index 00000000000..6c9569a0258 --- /dev/null +++ b/packages/specs/scalar/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "@tsed/typescript/tsconfig.node.json", + "compilerOptions": { + "baseUrl": ".", + "noEmit": true + }, + "include": [], + "references": [ + { + "path": "../openapi-utils/tsconfig.json" + }, + { + "path": "../../third-parties/normalize-path/tsconfig.json" + }, + { + "path": "./tsconfig.esm.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/specs/scalar/tsconfig.spec.json b/packages/specs/scalar/tsconfig.spec.json new file mode 100644 index 00000000000..6f1ccc47c95 --- /dev/null +++ b/packages/specs/scalar/tsconfig.spec.json @@ -0,0 +1,37 @@ +{ + "extends": "@tsed/typescript/tsconfig.node.json", + "compilerOptions": { + "baseUrl": ".", + "rootDir": "../..", + "declaration": false, + "composite": false, + "noEmit": true, + "paths": { + "@tsed/openspec": ["../openspec/src/index.ts"], + "@tsed/schema": ["../schema/src/index.ts"], + "@tsed/di": ["../../di/src/index.ts"], + "@tsed/exceptions": ["../exceptions/src/index.ts"], + "@tsed/json-mapper": ["../json-mapper/src/index.ts"], + "@tsed/platform-exceptions": ["../../platform/platform-exceptions/src/index.ts"], + "@tsed/platform-middlewares": ["../../platform/platform-middlewares/src/index.ts"], + "@tsed/platform-params": ["../../platform/platform-params/src/index.ts"], + "@tsed/platform-log-middleware": ["../../platform/platform-log-middleware/src/index.ts"], + "@tsed/platform-response-filter": ["../../platform/platform-response-filter/src/index.ts"], + "@tsed/platform-router": ["../../platform/platform-router/src/index.ts"], + "@tsed/platform-views": ["../../platform/platform-views/src/index.ts"], + "@tsed/normalize-path": ["../../utils/normalize-path/src/index.ts"], + "@tsed/components-scan": ["../../third-parties/components-scan/src/index.ts"], + "@tsed/platform-http": ["../../platform/platform-http/src/common/index.ts"], + "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], + "@tsed/ajv": ["../ajv/src/index.ts"], + "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], + "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], + "@tsed/platform-koa": ["../../platform/platform-koa/src/index.ts"], + "@tsed/mongoose": ["../../orm/mongoose/src/index.ts"] + }, + "types": ["vite/client", "vitest/globals"] + }, + "include": ["src/**/*.spec.ts", "test/**/*.spec.ts", "vitest.config.mts"], + "exclude": ["node_modules", "lib", "benchmark", "coverage"] +} diff --git a/packages/specs/scalar/views/assets/scalar.css b/packages/specs/scalar/views/assets/scalar.css new file mode 100644 index 00000000000..5f854c132da --- /dev/null +++ b/packages/specs/scalar/views/assets/scalar.css @@ -0,0 +1,96 @@ +/* basic theme */ +.light-mode { + --scalar-color-1: #353535; + --scalar-color-2: #555555; + --scalar-color-3: #aeaeae; + --scalar-color-accent: #259dff; + + --scalar-background-1: #fff; + --scalar-background-2: #f7f7f7; + --scalar-background-3: #dadada; + --scalar-background-accent: #E0F5FF; + + --scalar-border-color: rgba(0, 0, 0, 0.1); +} + +.dark-mode { + --scalar-color-1: rgba(255, 255, 255, 0.9); + --scalar-color-2: rgba(255, 255, 255, 0.62); + --scalar-color-3: rgba(255, 255, 255, 0.44); + --scalar-color-accent: #8ab4f8; + + --scalar-background-1: #1a1a1a; + --scalar-background-2: #252525; + --scalar-background-3: #323232; + --scalar-background-accent: #8ab4f81f; + + --scalar-border-color: rgba(255, 255, 255, 0.1); +} + +/* Document Sidebar */ +.light-mode .t-doc__sidebar { + --scalar-sidebar-background-1: var(--scalar-background-1); + --scalar-sidebar-item-hover-color: currentColor; + --scalar-sidebar-item-hover-background: var(--scalar-background-2); + --scalar-sidebar-item-active-background: var(--scalar-background-accent); + --scalar-sidebar-border-color: var(--scalar-border-color); + --scalar-sidebar-color-1: var(--scalar-color-1); + --scalar-sidebar-color-2: var(--scalar-color-2); + --scalar-sidebar-color-active: var(--scalar-color-accent); + --scalar-sidebar-search-background: transparent; + --scalar-sidebar-search-border-color: var(--scalar-border-color); + --scalar-sidebar-search-color: var(--scalar-color-3); +} + +.dark-mode .sidebar { + --scalar-sidebar-background-1: var(--scalar-background-1); + --scalar-sidebar-item-hover-color: currentColor; + --scalar-sidebar-item-hover-background: var(--scalar-background-2); + --scalar-sidebar-item-active-background: var(--scalar-background-accent); + --scalar-sidebar-border-color: var(--scalar-border-color); + --scalar-sidebar-color-1: var(--scalar-color-1); + --scalar-sidebar-color-2: var(--scalar-color-2); + --scalar-sidebar-color-active: var(--scalar-color-accent); + --scalar-sidebar-search-background: transparent; + --scalar-sidebar-search-border-color: var(--scalar-border-color); + --scalar-sidebar-search-color: var(--scalar-color-3); +} + +/* advanced */ +.light-mode { + --scalar-button-1: rgb(49 53 56); + --scalar-button-1-color: #fff; + --scalar-button-1-hover: rgb(28 31 33); + + --scalar-color-green: #669900; + --scalar-color-red: #dc4a68; + --scalar-color-yellow: #edbe20; + --scalar-color-blue: #0277aa; + --scalar-color-orange: #fb892c; + --scalar-color-purple: #5203d1; + + --scalar-scrollbar-color: rgba(0, 0, 0, 0.18); + --scalar-scrollbar-color-active: rgba(0, 0, 0, 0.36); +} + +.dark-mode { + --scalar-button-1: #f6f6f6; + --scalar-button-1-color: #000; + --scalar-button-1-hover: #e7e7e7; + + --scalar-color-green: #00b648; + --scalar-color-red: #dc1b19; + --scalar-color-yellow: #ffc90d; + --scalar-color-blue: #4eb3ec; + --scalar-color-orange: #ff8d4d; + --scalar-color-purple: #b191f9; + + --scalar-scrollbar-color: rgba(255, 255, 255, 0.24); + --scalar-scrollbar-color-active: rgba(255, 255, 255, 0.48); +} + +:root { + --scalar-radius: 3px; + --scalar-radius-lg: 3px; + --scalar-radius-xl: 3px; +} diff --git a/packages/specs/scalar/views/scalar.ejs b/packages/specs/scalar/views/scalar.ejs new file mode 100644 index 00000000000..ea0ace56057 --- /dev/null +++ b/packages/specs/scalar/views/scalar.ejs @@ -0,0 +1,19 @@ + + + + Scalar API Reference + + + + + + + + + + diff --git a/packages/specs/scalar/vitest.config.mts b/packages/specs/scalar/vitest.config.mts new file mode 100644 index 00000000000..d759e817941 --- /dev/null +++ b/packages/specs/scalar/vitest.config.mts @@ -0,0 +1,21 @@ +// @ts-ignore +import {presets} from "@tsed/vitest/presets"; +import {defineConfig} from "vitest/config"; + +export default defineConfig( + { + ...presets, + test: { + ...presets.test, + coverage: { + ...presets.test.coverage, + thresholds: { + statements: 0, + branches: 0, + functions: 0, + lines: 0 + } + } + } + } +); diff --git a/packages/specs/schema/tsconfig.spec.json b/packages/specs/schema/tsconfig.spec.json index 378488281c8..888373b0295 100644 --- a/packages/specs/schema/tsconfig.spec.json +++ b/packages/specs/schema/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/specs/swagger/package.json b/packages/specs/swagger/package.json index 1853d074cb4..0214b27e6a9 100644 --- a/packages/specs/swagger/package.json +++ b/packages/specs/swagger/package.json @@ -38,6 +38,7 @@ "@tsed/di": "workspace:*", "@tsed/json-mapper": "workspace:*", "@tsed/openspec": "workspace:*", + "@tsed/openapi-utils": "workspace:*", "@tsed/platform-http": "workspace:*", "@tsed/schema": "workspace:*", "@tsed/typescript": "workspace:*", diff --git a/packages/specs/swagger/src/SwaggerModule.spec.ts b/packages/specs/swagger/src/SwaggerModule.spec.ts index 5862a15f425..c0b402cd788 100644 --- a/packages/specs/swagger/src/SwaggerModule.spec.ts +++ b/packages/specs/swagger/src/SwaggerModule.spec.ts @@ -57,7 +57,7 @@ describe("SwaggerModule", () => { mod.$onReady(); - expect(logger().info).toHaveBeenCalledWith("[default] Swagger JSON is available on https://0.0.0.0:8081/doc/swagger.json"); + expect(logger().info).toHaveBeenCalledWith("[default] OpenAPI JSON is available on https://0.0.0.0:8081/doc/swagger.json"); expect(logger().info).toHaveBeenCalledWith("[default] Swagger UI is available on https://0.0.0.0:8081/doc/"); }); }); diff --git a/packages/specs/swagger/src/exports.ts b/packages/specs/swagger/src/exports.ts new file mode 100644 index 00000000000..205d7577be2 --- /dev/null +++ b/packages/specs/swagger/src/exports.ts @@ -0,0 +1 @@ +export {Docs, OpenAPIService as SwaggerService} from "@tsed/openapi-utils"; diff --git a/packages/specs/swagger/views/assets/swagger.css b/packages/specs/swagger/views/assets/swagger.css new file mode 100644 index 00000000000..831c8f547e2 --- /dev/null +++ b/packages/specs/swagger/views/assets/swagger.css @@ -0,0 +1,16 @@ +html { + box-sizing: border-box; + overflow: -moz-scrollbars-vertical; + overflow-y: scroll; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +body { + margin: 0; + background: #fafafa; +} diff --git a/packages/third-parties/agenda/tsconfig.spec.json b/packages/third-parties/agenda/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/agenda/tsconfig.spec.json +++ b/packages/third-parties/agenda/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/bullmq/tsconfig.spec.json b/packages/third-parties/bullmq/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/bullmq/tsconfig.spec.json +++ b/packages/third-parties/bullmq/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/components-scan/tsconfig.spec.json b/packages/third-parties/components-scan/tsconfig.spec.json index 573db0c2544..57135879e4b 100644 --- a/packages/third-parties/components-scan/tsconfig.spec.json +++ b/packages/third-parties/components-scan/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/event-emitter/tsconfig.spec.json b/packages/third-parties/event-emitter/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/event-emitter/tsconfig.spec.json +++ b/packages/third-parties/event-emitter/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/formio/tsconfig.spec.json b/packages/third-parties/formio/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/formio/tsconfig.spec.json +++ b/packages/third-parties/formio/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/normalize-path/tsconfig.spec.json b/packages/third-parties/normalize-path/tsconfig.spec.json index a018c43134a..820d53ed917 100644 --- a/packages/third-parties/normalize-path/tsconfig.spec.json +++ b/packages/third-parties/normalize-path/tsconfig.spec.json @@ -24,6 +24,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/pulse/tsconfig.spec.json b/packages/third-parties/pulse/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/pulse/tsconfig.spec.json +++ b/packages/third-parties/pulse/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/schema-formio/tsconfig.spec.json b/packages/third-parties/schema-formio/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/schema-formio/tsconfig.spec.json +++ b/packages/third-parties/schema-formio/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/socketio/tsconfig.spec.json b/packages/third-parties/socketio/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/socketio/tsconfig.spec.json +++ b/packages/third-parties/socketio/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/sse/tsconfig.spec.json b/packages/third-parties/sse/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/sse/tsconfig.spec.json +++ b/packages/third-parties/sse/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/stripe/tsconfig.spec.json b/packages/third-parties/stripe/tsconfig.spec.json index 78b4d89884a..4d109c048e4 100644 --- a/packages/third-parties/stripe/tsconfig.spec.json +++ b/packages/third-parties/stripe/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/temporal/tsconfig.spec.json b/packages/third-parties/temporal/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/temporal/tsconfig.spec.json +++ b/packages/third-parties/temporal/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/terminus/tsconfig.spec.json b/packages/third-parties/terminus/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/terminus/tsconfig.spec.json +++ b/packages/third-parties/terminus/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/packages/third-parties/vike/tsconfig.spec.json b/packages/third-parties/vike/tsconfig.spec.json index 23f578741d7..e82dc1af004 100644 --- a/packages/third-parties/vike/tsconfig.spec.json +++ b/packages/third-parties/vike/tsconfig.spec.json @@ -25,6 +25,7 @@ "@tsed/platform-http/testing": ["../../platform/platform-http/src/testing/index.ts"], "@tsed/ajv": ["../../specs/ajv/src/index.ts"], "@tsed/platform-cache": ["../../platform/platform-cache/src/index.ts"], + "@tsed/openapi-utils": ["../../specs/openapi-utils/src/index.ts"], "@tsed/swagger": ["../../specs/swagger/src/index.ts"], "@tsed/platform-test-sdk": ["../../platform/platform-test-sdk/src/index.ts"], "@tsed/platform-express": ["../../platform/platform-express/src/index.ts"], diff --git a/tools/integration/tsconfig.json b/tools/integration/tsconfig.json index 6d1739c855a..70a4d63c176 100644 --- a/tools/integration/tsconfig.json +++ b/tools/integration/tsconfig.json @@ -30,6 +30,9 @@ { "path": "../../packages/specs/schema/tsconfig.json" }, + { + "path": "../../packages/specs/openapi-utils/tsconfig.json" + }, { "path": "../../packages/specs/swagger/tsconfig.json" }, diff --git a/tsconfig.json b/tsconfig.json index 68b0cd8d16a..518e326ab43 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -83,9 +83,15 @@ { "path": "./packages/platform/platform-cache/tsconfig.json" }, + { + "path": "./packages/specs/openapi-utils/tsconfig.json" + }, { "path": "./packages/specs/swagger/tsconfig.json" }, + { + "path": "./packages/specs/scalar/tsconfig.json" + }, { "path": "./packages/platform/platform-test-sdk/tsconfig.json" }, diff --git a/yarn.lock b/yarn.lock index fbe72ce17ea..68dfaac34ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5391,6 +5391,23 @@ __metadata: languageName: node linkType: hard +"@scalar/openapi-types@npm:0.1.5": + version: 0.1.5 + resolution: "@scalar/openapi-types@npm:0.1.5" + checksum: 10/adbc8b9a67cc5d33dfed390735116a96967d866dcd814ea4df0e193d63d93d66f8293c0edd1b30fbff334812988065a96a5200576f6a1f4c98ea5d182f6f4ffc + languageName: node + linkType: hard + +"@scalar/types@npm:^0.0.23": + version: 0.0.23 + resolution: "@scalar/types@npm:0.0.23" + dependencies: + "@scalar/openapi-types": "npm:0.1.5" + "@unhead/schema": "npm:^1.11.11" + checksum: 10/bb424b4433cf95ed8a8a60fddd1643995c2aad9d34759cede7be6b54f64edf2a16a383da7bb02864a780203eb08adf9dbc75157bbc1da4fbceefa16f24b4b617 + languageName: node + linkType: hard + "@sec-ant/readable-stream@npm:^0.4.1": version: 0.4.1 resolution: "@sec-ant/readable-stream@npm:0.4.1" @@ -6575,14 +6592,14 @@ __metadata: peerDependenciesMeta: "@tsed/ajv": optional: false - "@tsed/common": - optional: false "@tsed/core": optional: false "@tsed/di": optional: false "@tsed/json-mapper": optional: false + "@tsed/platform-http": + optional: false "@tsed/schema": optional: false languageName: unknown @@ -6949,7 +6966,7 @@ __metadata: mongodb: "*" mongoose: ^8.7.0 peerDependenciesMeta: - "@tsed/common": + "@tsed/platform-http": optional: false languageName: unknown linkType: soft @@ -7329,19 +7346,44 @@ __metadata: peerDependenciesMeta: "@tsed/ajv": optional: false - "@tsed/common": - optional: false "@tsed/core": optional: false "@tsed/di": optional: false "@tsed/json-mapper": optional: false + "@tsed/platform-http": + optional: false "@tsed/schema": optional: false languageName: unknown linkType: soft +"@tsed/openapi-utils@workspace:*, @tsed/openapi-utils@workspace:packages/specs/openapi-utils": + version: 0.0.0-use.local + resolution: "@tsed/openapi-utils@workspace:packages/specs/openapi-utils" + dependencies: + "@tsed/barrels": "workspace:*" + "@tsed/core": "workspace:*" + "@tsed/di": "workspace:*" + "@tsed/json-mapper": "workspace:*" + "@tsed/openspec": "workspace:*" + "@tsed/platform-http": "workspace:*" + "@tsed/schema": "workspace:*" + "@tsed/typescript": "workspace:*" + eslint: "npm:9.12.0" + micromatch: "npm:4.0.8" + tslib: "npm:2.7.0" + typescript: "npm:5.4.5" + vitest: "npm:2.1.2" + peerDependencies: + "@tsed/platform-http": 8.2.0 + peerDependenciesMeta: + "@tsed/platform-http": + optional: false + languageName: unknown + linkType: soft + "@tsed/openspec@workspace:*, @tsed/openspec@workspace:packages/specs/openspec": version: 0.0.0-use.local resolution: "@tsed/openspec@workspace:packages/specs/openspec" @@ -7379,7 +7421,7 @@ __metadata: "@tsed/platform-http": 8.2.0 passport: ">=0.4.1" peerDependenciesMeta: - "@tsed/common": + "@tsed/platform-http": optional: false languageName: unknown linkType: soft @@ -7508,8 +7550,6 @@ __metadata: cross-env: 7.0.3 multer: ^1.4.5-lts.1 peerDependenciesMeta: - "@tsed/common": - optional: false "@tsed/core": optional: false "@tsed/di": @@ -7518,6 +7558,8 @@ __metadata: optional: false "@tsed/logger": optional: false + "@tsed/platform-http": + optional: false "@tsed/platform-views": optional: true "@tsed/schema": @@ -7614,8 +7656,6 @@ __metadata: koa-session: ">=6.2.0" multer: ^1.4.5-lts.1 peerDependenciesMeta: - "@tsed/common": - optional: false "@tsed/core": optional: false "@tsed/di": @@ -7626,6 +7666,8 @@ __metadata: optional: false "@tsed/openspec": optional: false + "@tsed/platform-http": + optional: false "@tsed/schema": optional: false multer: @@ -7849,8 +7891,6 @@ __metadata: "@tsed/schema": 8.2.0 serverless-http: ">=2.0.0" peerDependenciesMeta: - "@tsed/common": - optional: false "@tsed/core": optional: false "@tsed/di": @@ -7861,6 +7901,8 @@ __metadata: optional: false "@tsed/openspec": optional: false + "@tsed/platform-http": + optional: false "@tsed/schema": optional: false languageName: unknown @@ -8111,6 +8153,34 @@ __metadata: languageName: unknown linkType: soft +"@tsed/scalar@workspace:packages/specs/scalar": + version: 0.0.0-use.local + resolution: "@tsed/scalar@workspace:packages/specs/scalar" + dependencies: + "@scalar/types": "npm:^0.0.23" + "@tsed/barrels": "workspace:*" + "@tsed/core": "workspace:*" + "@tsed/di": "workspace:*" + "@tsed/json-mapper": "workspace:*" + "@tsed/normalize-path": "workspace:*" + "@tsed/openapi-utils": "workspace:*" + "@tsed/openspec": "workspace:*" + "@tsed/platform-http": "workspace:*" + "@tsed/schema": "workspace:*" + "@tsed/swagger": "workspace:*" + "@tsed/typescript": "workspace:*" + eslint: "npm:9.12.0" + tslib: "npm:2.7.0" + typescript: "npm:5.4.5" + vitest: "npm:2.1.2" + peerDependencies: + "@tsed/platform-http": 8.2.0 + peerDependenciesMeta: + "@tsed/platform-http": + optional: false + languageName: unknown + linkType: soft + "@tsed/schema-formio@workspace:packages/third-parties/schema-formio": version: 0.0.0-use.local resolution: "@tsed/schema-formio@workspace:packages/third-parties/schema-formio" @@ -8331,25 +8401,22 @@ __metadata: "@tsed/core": "workspace:*" "@tsed/di": "workspace:*" "@tsed/json-mapper": "workspace:*" - "@tsed/monorepo-utils": "npm:2.3.9" "@tsed/normalize-path": "workspace:*" + "@tsed/openapi-utils": "workspace:*" "@tsed/openspec": "workspace:*" "@tsed/platform-http": "workspace:*" "@tsed/schema": "workspace:*" "@tsed/typescript": "workspace:*" "@types/swagger-ui-dist": "npm:3.30.5" eslint: "npm:9.12.0" - fs-extra: "npm:11.2.0" - micromatch: "npm:4.0.8" swagger-ui-dist: "npm:>=5.17.14" - ts-node: "npm:10.9.2" tslib: "npm:2.7.0" typescript: "npm:5.4.5" vitest: "npm:2.1.2" peerDependencies: "@tsed/platform-http": 8.2.0 peerDependenciesMeta: - "@tsed/common": + "@tsed/platform-http": optional: false languageName: unknown linkType: soft @@ -8515,7 +8582,7 @@ __metadata: vike: ">=0.4.160" vite: ">=4" peerDependenciesMeta: - "@tsed/common": + "@tsed/platform-http": optional: false vike: optional: true @@ -9805,6 +9872,16 @@ __metadata: languageName: node linkType: hard +"@unhead/schema@npm:^1.11.11": + version: 1.11.13 + resolution: "@unhead/schema@npm:1.11.13" + dependencies: + hookable: "npm:^5.5.3" + zhead: "npm:^2.2.4" + checksum: 10/6142e258840afb9061822ec811fbb0a2145923ab46f3033d2e06c178f90d0512c8ca030f33c17bbc6b6edb481eafa7522f984bd00dcecbe7601167a7ca3b6cd1 + languageName: node + linkType: hard + "@vitest/coverage-v8@npm:^2.1.2": version: 2.1.2 resolution: "@vitest/coverage-v8@npm:2.1.2" @@ -17555,6 +17632,13 @@ __metadata: languageName: node linkType: hard +"hookable@npm:^5.5.3": + version: 5.5.3 + resolution: "hookable@npm:5.5.3" + checksum: 10/c6cec06f693e99a8f8ebd55592efc68042b472a4a04522dde384620d9a2cd7f422003357bf5688525f4bb14454bb0e4188a26db847fb1f1e06875958dfc61cde + languageName: node + linkType: hard + "hosted-git-info@npm:^2.1.4": version: 2.8.9 resolution: "hosted-git-info@npm:2.8.9" @@ -30259,6 +30343,13 @@ __metadata: languageName: node linkType: hard +"zhead@npm:^2.2.4": + version: 2.2.4 + resolution: "zhead@npm:2.2.4" + checksum: 10/cfa2ba81bf936fd4f5ba19360412c7017a164250823f22e575e1956b20c73d76b989985c02a4f89e2e02f3fb203fbe8857072cf5fbece59a374d1a6bf588555b + languageName: node + linkType: hard + "zip-stream@npm:^6.0.1": version: 6.0.1 resolution: "zip-stream@npm:6.0.1"