You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are receiving error below, when trying to generate documentation via redoc-cli tool. redoc-cli calls openapi-sampler and does not work properly with keys in swagger.
Error: Invalid reference token: Required__[keyinDeliverableWithWriterAlias]:boolean--__
at Function.get (/sr/app/node modules/openapi-sampler/dist/openapi-sampler.js:79:19)
at traverse (/usr/app/node_modules/openapi-sampler/dist/openapi-sampler.js:947:43)
at /usr/app/node_modules/openapi-sampler/dist/openapi-sampler.is:646:43
at Arrav.forEach(<anonvmous>)
at sample0biect (/us/app/node modules/openapi-sampler/dist/openapi-sampler.is:640:36
at traverse (/usr/app/node_modules/openapi-sampler/dist/openapi-sampler.js:1033:17)
at traverse (/usr/app/node_modules/openapi-sampler/dist/openapi-sampler.is:953:16)
at Object.sample (/usr/app/node_modules/openapi-sampler/dist/openapi-sampler.js:426:33)
at Hn.generateExample (/usr/app/node modules/redoc/bundles/redoc.lib.is:41:73780)
at new Hn (/usr/app/node modules/redoc/bundles/redoc. lib.js:41:73198)
What helped us is this patch:
diff --git a/node_modules/openapi-sampler/dist/openapi-sampler.js b/node_modules/openapi-sampler/dist/openapi-sampler.js
index 55fc164..4431786 100644
--- a/node_modules/openapi-sampler/dist/openapi-sampler.js
+++ b/node_modules/openapi-sampler/dist/openapi-sampler.js
@@ -938,7 +938,7 @@ function traverse(schema, options, spec, context) {
throw new Error('Your schema contains $ref. You must provide full specification in the third parameter.');
}
- var ref = decodeURIComponent(schema.$ref);
+ var ref = schema.$ref; // Fixes: "Error: Invalid reference token: Required__[keyinDeliverableWithWriterAlias]:boolean--__"
if (ref.startsWith('#')) {
ref = ref.substring(1);
The text was updated successfully, but these errors were encountered:
We are receiving error below, when trying to generate documentation via
redoc-cli
tool.redoc-cli
callsopenapi-sampler
and does not work properly with keys in swagger.Example of swagger file.
``` components: schemas: Required__%5BkeyinDeliverableWithWriterAlias%5D%3Aboolean--__: properties: system-administration: type: boolean system-use: type: boolean required: - system-administration - system-use type: object description: 'Make all properties in T required' ReleaseNotificationsBody: properties: commentsAll: type: boolean comments: $ref: '#/components/schemas/Required__%5BkeyinDeliverableWithWriterAlias%5D%3Aboolean--__' required: - commentsAll - comments type: object additionalProperties: false info: title: 'API v1' version: 3.18.0 openapi: 3.0.0 paths: '/releases/{releaseVersionId}/notifications': put: operationId: updateNotifications responses: '200': description: 'Release notifications updated' content: application/json: schema: $ref: '#/components/schemas/ReleaseNotificationsBody' summary: 'Update Release Notifications for current user' parameters: - in: path name: releaseVersionId required: true schema: $ref: '#/components/schemas/ReleaseVersionId' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ReleaseNotificationsBody' get: operationId: getNotifications responses: '200': description: 'Get release notifications' content: application/json: schema: $ref: '#/components/schemas/ReleaseNotificationsBody' summary: 'Get Release Notifications for current user' parameters: - in: path name: releaseVersionId required: true schema: $ref: '#/components/schemas/ReleaseVersionId' ```
What helped us is this patch:
The text was updated successfully, but these errors were encountered: