From 96f3861c90e96c8c6c375d464d9580b1c848fcc9 Mon Sep 17 00:00:00 2001 From: sct Date: Tue, 8 Dec 2020 10:28:38 +0000 Subject: [PATCH] chore(deps): update express-openapi-validator to v4.8.0 --- overseerr-api.yml | 25 +++++++++++++++++++++---- package.json | 2 +- server/index.ts | 13 +++++++------ server/routes/media.ts | 4 ++-- server/routes/request.ts | 4 ++-- yarn.lock | 38 ++++++++++++-------------------------- 6 files changed, 45 insertions(+), 41 deletions(-) diff --git a/overseerr-api.yml b/overseerr-api.yml index 398b5025b..d3fa089a0 100644 --- a/overseerr-api.yml +++ b/overseerr-api.yml @@ -375,6 +375,7 @@ components: example: 1 logoPath: type: string + nullable: true originCountry: type: string name: @@ -428,7 +429,8 @@ components: releaseDate: type: string revenue: - type: string + type: number + nullable: true runtime: type: number spokenLanguages: @@ -476,6 +478,7 @@ components: type: string airDate: type: string + nullable: true episodeNumber: type: number overview: @@ -483,11 +486,12 @@ components: productionCode: type: string seasonNumber: - type: string + type: number showId: type: number stillPath: type: string + nullable: true voteAverage: type: number voteCount: @@ -499,6 +503,7 @@ components: type: number airDate: type: string + nullable: true episodeCount: type: number name: @@ -536,6 +541,7 @@ components: type: number profilePath: type: string + nullable: true episodeRunTime: type: array items: @@ -658,6 +664,7 @@ components: tvdbId: type: number readOnly: true + nullable: true status: type: number requests: @@ -696,6 +703,7 @@ components: type: number profilePath: type: string + nullable: true Crew: type: object properties: @@ -715,25 +723,34 @@ components: type: string profilePath: type: string + nullable: true ExternalIds: type: object properties: facebookId: type: string + nullable: true freebaseId: type: string + nullable: true freebaseMid: type: string + nullable: true imdbId: type: string + nullable: true instagramId: type: string + nullable: true tvdbId: - type: string + type: number + nullable: true tvrageId: - type: string + type: number + nullable: true twitterId: type: string + nullable: true ServiceProfile: type: object properties: diff --git a/package.json b/package.json index 0e56831fe..fce142760 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "cookie-parser": "^1.4.5", "email-templates": "^8.0.0", "express": "^4.17.1", - "express-openapi-validator": "^3.16.15", + "express-openapi-validator": "^4.8.0", "express-session": "^1.17.1", "formik": "^2.2.1", "intl": "^1.2.5", diff --git a/server/index.ts b/server/index.ts index e85fb1500..6c469371e 100644 --- a/server/index.ts +++ b/server/index.ts @@ -9,7 +9,7 @@ import session, { Store } from 'express-session'; import { TypeormStore } from 'connect-typeorm/out'; import YAML from 'yamljs'; import swaggerUi from 'swagger-ui-express'; -import { OpenApiValidator } from 'express-openapi-validator'; +import * as OpenApiValidator from 'express-openapi-validator'; import { Session } from './entity/Session'; import { getSettings } from './lib/settings'; import logger from './logger'; @@ -61,11 +61,12 @@ app ); const apiDocs = YAML.load(API_SPEC_PATH); server.use('/api-docs', swaggerUi.serve, swaggerUi.setup(apiDocs)); - await new OpenApiValidator({ - apiSpec: API_SPEC_PATH, - validateRequests: true, - validateResponses: true, - }).install(server); + server.use( + OpenApiValidator.middleware({ + apiSpec: API_SPEC_PATH, + validateRequests: true, + }) + ); /** * This is a workaround to convert dates to strings before they are validated by * OpenAPI validator. Otherwise, they are treated as objects instead of strings diff --git a/server/routes/media.ts b/server/routes/media.ts index b69423a14..36e64e6eb 100644 --- a/server/routes/media.ts +++ b/server/routes/media.ts @@ -12,8 +12,8 @@ const mediaRoutes = Router(); mediaRoutes.get('/', async (req, res, next) => { const mediaRepository = getRepository(Media); - const pageSize = Number(req.query.take) ?? 20; - const skip = Number(req.query.skip) ?? 0; + const pageSize = req.query.take ? Number(req.query.take) : 20; + const skip = req.query.skip ? Number(req.query.skip) : 0; let statusFilter: | MediaStatus diff --git a/server/routes/request.ts b/server/routes/request.ts index 15709b597..b5602572b 100644 --- a/server/routes/request.ts +++ b/server/routes/request.ts @@ -15,8 +15,8 @@ const requestRoutes = Router(); requestRoutes.get('/', async (req, res, next) => { const requestRepository = getRepository(MediaRequest); try { - const pageSize = Number(req.query.take) ?? 20; - const skip = Number(req.query.skip) ?? 0; + const pageSize = req.query.take ? Number(req.query.take) : 20; + const skip = req.query.skip ? Number(req.query.skip) : 0; let statusFilter: | MediaRequestStatus diff --git a/yarn.lock b/yarn.lock index 150e5b914..a4575d574 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2579,7 +2579,7 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^6.12.5: +ajv@^6.12.5, ajv@^6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -4715,14 +4715,6 @@ dayjs@^1.9.6: resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.9.6.tgz#6f0c77d76ac1ff63720dd1197e5cb87b67943d70" integrity sha512-HngNLtPEBWRo8EFVmHFmSXAjtCX8rGNqeXQI0Gh7wCTSqwaKgPIDqu9m07wABVopNwzvOeCb+2711vQhDlcIXw== -deasync@^0.1.20: - version "0.1.20" - resolved "https://registry.yarnpkg.com/deasync/-/deasync-0.1.20.tgz#546fd2660688a1eeed55edce2308c5cf7104f9da" - integrity sha512-E1GI7jMI57hL30OX6Ht/hfQU8DO4AuB9m72WFm4c38GNbUD4Q03//XZaOIHZiY+H1xUaomcot5yk2q/qIZQkGQ== - dependencies: - bindings "^1.5.0" - node-addon-api "^1.7.1" - debug@2.6.9, debug@^2.2.0, debug@^2.3.3: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -5734,24 +5726,23 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2: dependencies: homedir-polyfill "^1.0.1" -express-openapi-validator@^3.16.15: - version "3.16.15" - resolved "https://registry.yarnpkg.com/express-openapi-validator/-/express-openapi-validator-3.16.15.tgz#f382c2de474b373cadc0ce5ed5a2e7a4f1d5629f" - integrity sha512-Xd+lZ84iyV68KKk45ZQgkANtlDnpJ0KYcUgen8ASaS25svb5V/KF35zlzsqTNYz5KcpMDBHnueYFdCTzvIRxUA== +express-openapi-validator@^4.8.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/express-openapi-validator/-/express-openapi-validator-4.8.0.tgz#f45d52728bd4efabd71c43c4a8424892173ffff9" + integrity sha512-cDcMOiawm0ZCMKKltn0ySwQum6gSV8kxImc19UDu3Wu67GFDYe7qQHwmVcAISR/AxfpPkzum/LphYqZDfVRr1w== dependencies: - ajv "^6.12.4" + ajv "^6.12.6" content-type "^1.0.4" js-yaml "^3.14.0" json-schema-ref-parser "^9.0.6" + lodash.clonedeep "^4.5.0" lodash.merge "^4.6.2" lodash.uniq "^4.5.0" lodash.zipobject "^4.1.3" media-typer "^1.1.0" multer "^1.4.2" ono "^7.1.3" - path-to-regexp "^6.1.0" - optionalDependencies: - deasync "^0.1.20" + path-to-regexp "^6.2.0" express-session@^1.15.6, express-session@^1.17.1: version "1.17.1" @@ -9118,11 +9109,6 @@ node-addon-api@2.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.0.tgz#f9afb8d777a91525244b01775ea0ddbe1125483b" integrity sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA== -node-addon-api@^1.7.1: - version "1.7.2" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.2.tgz#3df30b95720b53c24e59948b49532b662444f54d" - integrity sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg== - node-addon-api@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.0.2.tgz#04bc7b83fd845ba785bb6eae25bc857e1ef75681" @@ -10200,10 +10186,10 @@ path-to-regexp@0.1.7: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= -path-to-regexp@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.1.0.tgz#0b18f88b7a0ce0bfae6a25990c909ab86f512427" - integrity sha512-h9DqehX3zZZDCEm+xbfU0ZmwCGFCAAraPJWMXJ4+v32NjZJilVg3k1TcKsRgIb8IQ/izZSaydDc1OhJCZvs2Dw== +path-to-regexp@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.0.tgz#f7b3803336104c346889adece614669230645f38" + integrity sha512-f66KywYG6+43afgE/8j/GoiNyygk/bnoCbps++3ErRKsIYkGGupyv07R2Ok5m9i67Iqc+T2g1eAUGUPzWhYTyg== path-type@^2.0.0: version "2.0.0"