From e0b3a60e783678d7ae136a7d38a1c5f36ca76ee3 Mon Sep 17 00:00:00 2001 From: Nicolas Froidure Date: Wed, 3 Mar 2021 16:24:44 +0100 Subject: [PATCH] fix(@whook/http-router): fix compatibility issue --- packages/whook-example/src/handlers/getTime.ts | 5 ++++- .../src/services/__snapshots__/API.test.ts.snap | 1 - packages/whook-http-router/src/index.ts | 10 +++++++++- .../whook-oauth2/src/handlers/postOAuth2Acknowledge.ts | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/whook-example/src/handlers/getTime.ts b/packages/whook-example/src/handlers/getTime.ts index 34d2d06f..062f5ddb 100644 --- a/packages/whook-example/src/handlers/getTime.ts +++ b/packages/whook-example/src/handlers/getTime.ts @@ -9,7 +9,10 @@ export const timeSchema: WhookAPISchemaDefinition type: 'object', additionalProperties: false, properties: { - currentDate: { type: 'string', format: 'date-time' }, + currentDate: { + type: 'string', + // format: 'date-time' + }, }, }, }; diff --git a/packages/whook-example/src/services/__snapshots__/API.test.ts.snap b/packages/whook-example/src/services/__snapshots__/API.test.ts.snap index a7912c52..fd35c0b2 100644 --- a/packages/whook-example/src/services/__snapshots__/API.test.ts.snap +++ b/packages/whook-example/src/services/__snapshots__/API.test.ts.snap @@ -117,7 +117,6 @@ Object { "additionalProperties": false, "properties": Object { "currentDate": Object { - "format": "date-time", "type": "string", }, }, diff --git a/packages/whook-http-router/src/index.ts b/packages/whook-http-router/src/index.ts index cf506f31..1ba0e262 100644 --- a/packages/whook-http-router/src/index.ts +++ b/packages/whook-http-router/src/index.ts @@ -565,10 +565,18 @@ async function _createRouters({ if (p.style) { log('warning', '⚠️ - Only a style subset is supported currently!'); } + return { ...p, - pattern: '^.*$', + // TODO: Remove when this issue is tackled: + // https://github.com/nfroidure/siso/issues/45 + ...((p.schema as OpenAPIV3.SchemaObject)?.enum + ? {} + : { + pattern: '^.*$', + }), ...p.schema, + schema: undefined, }; }); const ammendedParameters = extractOperationSecurityParameters( diff --git a/packages/whook-oauth2/src/handlers/postOAuth2Acknowledge.ts b/packages/whook-oauth2/src/handlers/postOAuth2Acknowledge.ts index f7db0649..94084889 100644 --- a/packages/whook-oauth2/src/handlers/postOAuth2Acknowledge.ts +++ b/packages/whook-oauth2/src/handlers/postOAuth2Acknowledge.ts @@ -82,7 +82,7 @@ export const definition: WhookAPIHandlerDefinition = { properties: { redirectURI: { type: 'string', - format: 'uri', + // format: 'uri', }, }, },