From f8925facf822f9bdb1cb2d3d14aea644d4e2840f Mon Sep 17 00:00:00 2001 From: Heather Cloward Date: Sun, 12 Sep 2021 21:41:29 -0400 Subject: [PATCH 01/25] Updates readme with about section and organizes features list --- README.md | 93 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 77 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 855dac49..9ed57fa8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
ReDoc logo - **OpenAPI/Swagger-generated API Reference Documentation** + # Generate interactive API documentation from OpenAPI definitions [![Build Status](https://travis-ci.com/Redocly/redoc.svg?branch=master)](https://travis-ci.com/Redocly/redoc) [![Coverage Status](https://coveralls.io/repos/Redocly/redoc/badge.svg?branch=master&service=github)](https://coveralls.io/github/Redocly/redoc?branch=master) [![dependencies Status](https://david-dm.org/Redocly/redoc/status.svg)](https://david-dm.org/Redocly/redoc) [![devDependencies Status](https://david-dm.org/Redocly/redoc/dev-status.svg)](https://david-dm.org/Redocly/redoc#info=devDependencies) [![npm](http://img.shields.io/npm/v/redoc.svg)](https://www.npmjs.com/package/redoc) [![License](https://img.shields.io/npm/l/redoc.svg)](https://github.com/Redocly/redoc/blob/master/LICENSE) @@ -11,30 +11,60 @@ **This is the README for the `2.x` version of Redoc (React-based).** **The README for the `1.x` version is on the [v1.x](https://github.com/Redocly/redoc/tree/v1.x) branch** +## About Redoc + +Redoc is an open-source tool for generating OpenAPI(aka Swagger) definitions. By default +Redoc offers a three-panel, responsive layout: the left panel contains a search bar and navigation menu, +the central panel contains the documentation, and the right panel contains request and response +examples. + ![ReDoc demo](https://raw.githubusercontent.com/Redocly/redoc/master/demo/redoc-demo.png) -## [Live demo](http://redocly.github.io/redoc/) +## Live demo -[Deploy to Github](https://github.com/Rebilly/generator-openapi-repo#generator-openapi-repo--) [ReDoc as a service](https://redoc.ly) [Customization services](https://redoc.ly/#services) +If you want to see how ReDoc will render your OpenAPI definition, +you can try it out online at https://redocly.github.io/redoc/. + +A version of the Swagger Petstore API is displayed by default. +To test it with your own OpenAPI definition, +enter the URL for your definition and select **TRY IT**. + +## Redoc vs. Redocly Reference docs + +Redoc Community Edition is free open-source software (OSS). +Redocly has developed extensive enhancements on top of Redoc Community Edition's open core, creating Redocly Reference Docs. +See [Comparison Redoc CE vs. Redocly Reference Docs](https://redoc.ly/redoc-vs-reference/) +for the main differences between the Redoc Community Edition and Redocly Reference Docs. + +## Deploy to GitHub +[Deploy to Github](https://github.com/Rebilly/generator-openapi-repo#generator-openapi-repo--) + +## Redoc as a service +[Redoc as a service](https://redoc.ly/workflows) ## Features -- [Multiple deployment options](https://redoc.ly/docs/redoc/quickstart/intro/) -- [Server-side rendering (SSR) ready](https://redoc.ly/docs/redoc/quickstart/cli/#redoc-cli-commands) -- [Simple integration with `create-react-app`](https://redoc.ly/docs/redoc/quickstart/react/) - - [See an example](https://github.com/APIs-guru/create-react-app-redoc) -- [Command-line interface to bundle your docs into a **zero-dependency** HTML file](https://redoc.ly/docs/redoc/quickstart/cli/) - Responsive three-panel design with menu/scrolling synchronization +- [Multiple deployment options](https://redoc.ly/docs/redoc/quickstart/intro/) - Deep linking support +- [Server-side rendering (SSR) ready](https://redoc.ly/docs/redoc/quickstart/cli/#redoc-cli-commands) - Ability to integrate your API introduction into the side menu -- High-level grouping in side-menu with [`x-tagGroups`](https://redoc.ly/docs/api-reference-docs/specification-extensions/x-tag-groups/) specification extension +- [Simple integration with `create-react-app`](https://redoc.ly/docs/redoc/quickstart/react/) + + [Example repo](https://github.com/APIs-guru/create-react-app-redoc) +- [Command-line interface to bundle your docs into a **zero-dependency** HTML file](https://redoc.ly/docs/redoc/quickstart/cli/) +- Neat **interactive** documentation for nested objects
+ ![](docs/images/nested-demo.gif) + +## Customization options +[Customization services](https://redoc.ly/#services) +- High-level grouping in side-menu with the [`x-tagGroups`](https://redoc.ly/docs/api-reference-docs/specification-extensions/x-tag-groups/) specification extension - Branding/customizations using the [`theme` option](https://redoc.ly/docs/api-reference-docs/configuration/theming/) + +## Support - OpenAPI v3.0 support - Basic OpenAPI v3.1 support - Broad OpenAPI v2.0 feature support (yes, it supports even `discriminator`)
![](docs/images/discriminator-demo.gif) -- Neat **interactive** documentation for nested objects
- ![](docs/images/nested-demo.gif) - Code samples support (via vendor extension)
![](docs/images/code-samples-demo.gif) @@ -44,7 +74,7 @@ - `next` release: https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN **(deprecated)**: -- particular release, e.g. `v1.2.0`: https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js +- particular release, for example `v1.2.0`: https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js - `v1.x.x` release: https://rebilly.github.io/ReDoc/releases/v1.x.x/redoc.min.js - `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js - it will point to latest 1.x.x release since 2.x releases are not hosted on this CDN but on unpkg. @@ -67,15 +97,46 @@ Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN **(d - [BoxKnight](https://www.docs.boxknight.com/) ## Deployment + +### TL;DR final code example + +```html + + + + Redoc + + + + + + + + + + + + + + +``` + For step-by-step instructions for how to get started using Redoc to render your OpenAPI definition, refer to the -[Redoc quickstart guide](https://redoc.ly/docs/redoc/quickstart/intro/). +[**Redoc quickstart guide**](https://redoc.ly/docs/redoc/quickstart/intro/). -[**IE11 Support Notes**](docs/usage-with-ie11.md) +See [**IE11 Support Notes**](docs/usage-with-ie11.md) for information on ## ReDoc CLI For more information on Redoc's commmand-line interface, refer to -[Using the Redoc CLI](https://redoc.ly/docs/redoc/quickstart/cli/). +[**Using the Redoc CLI**](https://redoc.ly/docs/redoc/quickstart/cli/). ## Configuration From 899d7f9637815619d708ef8cfd1078b6339bfe61 Mon Sep 17 00:00:00 2001 From: Heather Cloward Date: Mon, 13 Sep 2021 07:22:18 -0400 Subject: [PATCH 02/25] Adds some notes to deployment --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 9ed57fa8..5647e2fd 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,9 @@ Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN **(d ### TL;DR final code example +To render your OpenAPI definition using Redoc, use the following HTML code sample and +replace the `spec-url` attribute with the url or local file address to your definition. + ```html @@ -133,6 +136,7 @@ to render your OpenAPI definition, refer to the [**Redoc quickstart guide**](https://redoc.ly/docs/redoc/quickstart/intro/). See [**IE11 Support Notes**](docs/usage-with-ie11.md) for information on +IE support for Redoc. ## ReDoc CLI For more information on Redoc's commmand-line interface, refer to From bd9390a5bfc5458c06121110db33968a20fcebe4 Mon Sep 17 00:00:00 2001 From: Mark Theisen Date: Tue, 14 Sep 2021 05:08:50 -0500 Subject: [PATCH 03/25] feat: new option generatedPayloadSamplesMaxDepth (#1642) --- README.md | 1 + src/services/RedocNormalizedOptions.ts | 16 ++++++++++++++++ src/services/models/MediaType.ts | 4 +++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 855dac49..2bbdc134 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ You can use all of the following options with the standalone version of the number; hideHostname: boolean; @@ -196,6 +207,7 @@ export class RedocNormalizedOptions { ignoreNamedSchemas: Set; hideSchemaPattern: boolean; + generatedPayloadSamplesMaxDepth: number; constructor(raw: RedocRawOptions, defaults: RedocRawOptions = {}) { raw = { ...defaults, ...raw }; @@ -257,5 +269,9 @@ export class RedocNormalizedOptions { : raw.ignoreNamedSchemas?.split(',').map((s) => s.trim()); this.ignoreNamedSchemas = new Set(ignoreNamedSchemas); this.hideSchemaPattern = argValueToBoolean(raw.hideSchemaPattern); + this.generatedPayloadSamplesMaxDepth = + RedocNormalizedOptions.normalizeGeneratedPayloadSamplesMaxDepth( + raw.generatedPayloadSamplesMaxDepth, + ); } } diff --git a/src/services/models/MediaType.ts b/src/services/models/MediaType.ts index 8987fbbb..9e41d89a 100644 --- a/src/services/models/MediaType.ts +++ b/src/services/models/MediaType.ts @@ -14,6 +14,7 @@ export class MediaTypeModel { name: string; isRequestType: boolean; onlyRequiredInSamples: boolean; + generatedPayloadSamplesMaxDepth: number; /** * @param isRequestType needed to know if skipe RO/RW fields in objects @@ -29,6 +30,7 @@ export class MediaTypeModel { this.isRequestType = isRequestType; this.schema = info.schema && new SchemaModel(parser, info.schema, '', options); this.onlyRequiredInSamples = options.onlyRequiredInSamples; + this.generatedPayloadSamplesMaxDepth = options.generatedPayloadSamplesMaxDepth; if (info.examples !== undefined) { this.examples = mapValues( info.examples, @@ -53,7 +55,7 @@ export class MediaTypeModel { skipReadOnly: this.isRequestType, skipWriteOnly: !this.isRequestType, skipNonRequired: this.isRequestType && this.onlyRequiredInSamples, - maxSampleDepth: 10, + maxSampleDepth: this.generatedPayloadSamplesMaxDepth, }; if (this.schema && this.schema.oneOf) { this.examples = {}; From 3f6bf5febbd61f5ab99b5efb50006465110f3f5d Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Mon, 20 Sep 2021 14:08:58 +0300 Subject: [PATCH 04/25] chore: update libs (#1707) --- package-lock.json | 74 ++++++++++++++++++++++++++++------------------- package.json | 4 +-- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73cfe473..41b9dcc2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,8 @@ "license": "MIT", "dependencies": { "@babel/runtime": "^7.14.0", - "@redocly/openapi-core": "^1.0.0-beta.50", + "@redocly/openapi-core": "^1.0.0-beta.54", "@redocly/react-dropdown-aria": "^2.0.11", - "@types/node": "^15.6.1", "classnames": "^2.3.1", "decko": "^1.2.0", "dompurify": "^2.2.8", @@ -59,6 +58,7 @@ "@types/lunr": "^2.3.3", "@types/mark.js": "^8.11.5", "@types/marked": "^1.1.0", + "@types/node": "^15.6.1", "@types/prismjs": "^1.16.5", "@types/prop-types": "^15.7.3", "@types/react": "^17.0.8", @@ -2672,13 +2672,13 @@ } }, "node_modules/@redocly/ajv": { - "version": "6.12.4", - "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-6.12.4.tgz", - "integrity": "sha512-RB6vWO78v6c+SW/3bZh+XZMr4nGdJKAiPGsBALuUZnLuCiQ7aXCT1AuFHqnfS2gyXbEUEj+kw8p4ux8KdAfs3A==", + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.6.2.tgz", + "integrity": "sha512-tU8fQs0D76ZKhJ2cWtnfQthWqiZgGBx0gH0+5D8JvaBEBaqA8foPPBt3Nonwr3ygyv5xrw2IzKWgIY86BlGs+w==", "dependencies": { "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", "uri-js": "^4.2.2" }, "funding": { @@ -2686,12 +2686,17 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/@redocly/ajv/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, "node_modules/@redocly/openapi-core": { - "version": "1.0.0-beta.50", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.50.tgz", - "integrity": "sha512-GuXn4IETxpbRd8dlAQDQPtvqOpbMvPMeC/e5mv5MOXkLIznNk4vjiQVe6QSCbZbCHzzpb2+89B6S7asebPm4Rg==", + "version": "1.0.0-beta.54", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.54.tgz", + "integrity": "sha512-uYs0N1Trjkh7u8IMIuCU2VxCXhMyGWSZUkP/WNdTR1OgBUtvNdF9C32zoQV+hyCIH4gVu42ROHkjisy333ZX+w==", "dependencies": { - "@redocly/ajv": "^6.12.3", + "@redocly/ajv": "^8.6.2", "@types/node": "^14.11.8", "colorette": "^1.2.0", "js-levenshtein": "^1.1.6", @@ -3038,7 +3043,8 @@ "node_modules/@types/node": { "version": "15.12.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.2.tgz", - "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==" + "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==", + "dev": true }, "node_modules/@types/normalize-package-data": { "version": "2.4.0", @@ -8358,7 +8364,8 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -13267,7 +13274,8 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -16757,7 +16765,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -22961,22 +22968,29 @@ } }, "@redocly/ajv": { - "version": "6.12.4", - "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-6.12.4.tgz", - "integrity": "sha512-RB6vWO78v6c+SW/3bZh+XZMr4nGdJKAiPGsBALuUZnLuCiQ7aXCT1AuFHqnfS2gyXbEUEj+kw8p4ux8KdAfs3A==", + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.6.2.tgz", + "integrity": "sha512-tU8fQs0D76ZKhJ2cWtnfQthWqiZgGBx0gH0+5D8JvaBEBaqA8foPPBt3Nonwr3ygyv5xrw2IzKWgIY86BlGs+w==", "requires": { "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", "uri-js": "^4.2.2" + }, + "dependencies": { + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + } } }, "@redocly/openapi-core": { - "version": "1.0.0-beta.50", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.50.tgz", - "integrity": "sha512-GuXn4IETxpbRd8dlAQDQPtvqOpbMvPMeC/e5mv5MOXkLIznNk4vjiQVe6QSCbZbCHzzpb2+89B6S7asebPm4Rg==", + "version": "1.0.0-beta.54", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.54.tgz", + "integrity": "sha512-uYs0N1Trjkh7u8IMIuCU2VxCXhMyGWSZUkP/WNdTR1OgBUtvNdF9C32zoQV+hyCIH4gVu42ROHkjisy333ZX+w==", "requires": { - "@redocly/ajv": "^6.12.3", + "@redocly/ajv": "^8.6.2", "@types/node": "^14.11.8", "colorette": "^1.2.0", "js-levenshtein": "^1.1.6", @@ -23312,7 +23326,8 @@ "@types/node": { "version": "15.12.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.2.tgz", - "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==" + "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==", + "dev": true }, "@types/normalize-package-data": { "version": "2.4.0", @@ -27480,7 +27495,8 @@ "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -31180,7 +31196,8 @@ "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -33869,8 +33886,7 @@ "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" }, "require-main-filename": { "version": "2.0.0", diff --git a/package.json b/package.json index 6f57959e..b4fb9912 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "@types/json-pointer": "^1.0.30", "@types/lodash": "^4.14.170", "@types/lunr": "^2.3.3", + "@types/node": "^15.6.1", "@types/mark.js": "^8.11.5", "@types/marked": "^1.1.0", "@types/prismjs": "^1.16.5", @@ -146,9 +147,8 @@ }, "dependencies": { "@babel/runtime": "^7.14.0", - "@redocly/openapi-core": "^1.0.0-beta.50", + "@redocly/openapi-core": "^1.0.0-beta.54", "@redocly/react-dropdown-aria": "^2.0.11", - "@types/node": "^15.6.1", "classnames": "^2.3.1", "decko": "^1.2.0", "dompurify": "^2.2.8", From c87600d520f037d291169b44b5803a35af16b5a5 Mon Sep 17 00:00:00 2001 From: Ivana Isadora Devcic <33730345+skadinna@users.noreply.github.com> Date: Tue, 21 Sep 2021 22:17:48 +0200 Subject: [PATCH 05/25] fix: Redoc spelling --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5647e2fd..7205e4f7 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ examples. ## Live demo -If you want to see how ReDoc will render your OpenAPI definition, +If you want to see how Redoc will render your OpenAPI definition, you can try it out online at https://redocly.github.io/redoc/. A version of the Swagger Petstore API is displayed by default. @@ -138,7 +138,7 @@ to render your OpenAPI definition, refer to the See [**IE11 Support Notes**](docs/usage-with-ie11.md) for information on IE support for Redoc. -## ReDoc CLI +## Redoc CLI For more information on Redoc's commmand-line interface, refer to [**Using the Redoc CLI**](https://redoc.ly/docs/redoc/quickstart/cli/). From 669adddc9dc3590df997b234e274b849c708d715 Mon Sep 17 00:00:00 2001 From: Heather Cloward Date: Wed, 22 Sep 2021 22:17:19 -0400 Subject: [PATCH 06/25] Updates per reviews and adds new logo --- README.md | 13 ++++++++----- docs/images/redoc.png | Bin 0 -> 8047 bytes 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 docs/images/redoc.png diff --git a/README.md b/README.md index 5647e2fd..7f55d8af 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
- ReDoc logo + ReDoc logo # Generate interactive API documentation from OpenAPI definitions @@ -13,10 +13,13 @@ ## About Redoc -Redoc is an open-source tool for generating OpenAPI(aka Swagger) definitions. By default -Redoc offers a three-panel, responsive layout: the left panel contains a search bar and navigation menu, -the central panel contains the documentation, and the right panel contains request and response -examples. +Redoc is an open-source tool for generating documentation from OpenAPI (fka Swagger) definitions. + +By default Redoc offers a three-panel, responsive layout: + +- The left panel contains a search bar and navigation menu. +- The central panel contains the documentation. +- The right panel contains request and response examples. ![ReDoc demo](https://raw.githubusercontent.com/Redocly/redoc/master/demo/redoc-demo.png) diff --git a/docs/images/redoc.png b/docs/images/redoc.png new file mode 100644 index 0000000000000000000000000000000000000000..15579760928b664b526cc89aedceecfb72460154 GIT binary patch literal 8047 zcmeHs_g52L)HMmAiwPa1#n6O+(gc(iFi3CGJE%12N|hEsARxUXQlytqLN^rYC?Hju zBGQYYgMfhWhUfbaz8~N9t~D!b&dfb??>*}Mh(P6<_{g1#?cJ3A_!;r{o&b?x^o{kyN+AAy*dO;R*X3LR%p0w+jk z6>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6%@2k5J*OEj2pi>boluGldqC>4Z9Fg3QxW7 zl*=5A2B24?>P6<;&Y_m%l3?mSzbSDSs-=k2PG4wo##7?T7cGQVx2LnaA2el8AQfqA z9E$AZqok__B1w{DT#=Jn{Y*y9D`2RLq=yf#fVXSlLJtyY_IF`iWH)shbD#) zgoQT*o<~u5;4&5VLZ<9gTTVS!K@TKREb8(gl(o? z%MO{Lny&i5&{u!x)^w3JD~fquxBvO=-9qlO>BA9 zpOC69WtOdxf72}oOaz`k@mk%f!Dl({Iwv>peVTu~pBg~;M47F;9Bw8oZ3U4>4+P$w zVXP<6dWNYVF!X-)bYSD*_@JWU(`K$DdI46x4V-4& zH-(ad+sBQ>1ugh$?!NgiS^6L~I8+o1{?0);)Avp)@WaMraLOo)_4A4XpAOPx6#_5A zl)<4%VEGY1USJUuL~rTufAUoVN*X|kmX Date: Wed, 22 Sep 2021 22:20:49 -0400 Subject: [PATCH 07/25] Minor edits --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93de7281..cc80f831 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ By default Redoc offers a three-panel, responsive layout: - The central panel contains the documentation. - The right panel contains request and response examples. -![ReDoc demo](https://raw.githubusercontent.com/Redocly/redoc/master/demo/redoc-demo.png) +![Redoc demo](https://raw.githubusercontent.com/Redocly/redoc/master/demo/redoc-demo.png) ## Live demo @@ -82,7 +82,7 @@ Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN **(d - `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js - it will point to latest 1.x.x release since 2.x releases are not hosted on this CDN but on unpkg. ## Version Guidance -| ReDoc Release | OpenAPI Specification | +| Redoc Release | OpenAPI Specification | |:--------------|:----------------------| | 2.0.0-alpha.54| 3.1, 3.0.x, 2.0 | | 2.0.0-alpha.x | 3.0, 2.0 | From bccd21394ef79940c2efbe24a0d866c7af103d94 Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Mon, 27 Sep 2021 12:21:59 +0300 Subject: [PATCH 08/25] fix: scrolling to the first item (#1753) --- e2e/integration/menu.e2e.ts | 23 +++++++++++++++++++++++ src/services/MenuStore.ts | 1 + 2 files changed, 24 insertions(+) diff --git a/e2e/integration/menu.e2e.ts b/e2e/integration/menu.e2e.ts index e1b053d1..533fb0ea 100644 --- a/e2e/integration/menu.e2e.ts +++ b/e2e/integration/menu.e2e.ts @@ -25,6 +25,29 @@ describe('Menu', () => { .should('be.visible'); }); + it('should sync active menu items while scroll back and scroll again', () => { + cy.contains('h2', 'Add a new pet to the store') + .scrollIntoView() + .wait(100) + .get('[role=menuitem].active') + .children() + .last() + .should('have.text', 'Add a new pet to the store') + .should('be.visible'); + + cy.contains('h1', 'Swagger Petstore') + .scrollIntoView() + .wait(100) + + cy.contains('h1', 'Introduction') + .scrollIntoView() + .wait(100) + .get('[role=menuitem].active') + .should('have.text', 'Introduction'); + + cy.url().should('include', '#section/Introduction'); + }); + it('should update URL hash when clicking on menu items', () => { cy.contains('[role=menuitem].-depth1', 'pet').click({ force: true }); cy.location('hash').should('equal', '#tag/pet'); diff --git a/src/services/MenuStore.ts b/src/services/MenuStore.ts index ac60fee8..65f6c7c8 100644 --- a/src/services/MenuStore.ts +++ b/src/services/MenuStore.ts @@ -210,6 +210,7 @@ export class MenuStore { this.deactivate(this.activeItem); if (!item) { + this.activeItemIdx = -1; this.history.replace('', rewriteHistory); return; } From 1c8578ea8840b9e0cc8f66eda317c6839b9c1383 Mon Sep 17 00:00:00 2001 From: Heather Cloward Date: Sat, 9 Oct 2021 14:40:39 -0400 Subject: [PATCH 09/25] Adds comparison table and OpenAPI link section --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index cc80f831..5074978b 100644 --- a/README.md +++ b/README.md @@ -32,23 +32,53 @@ A version of the Swagger Petstore API is displayed by default. To test it with your own OpenAPI definition, enter the URL for your definition and select **TRY IT**. -## Redoc vs. Redocly Reference docs +## Redoc vs. Reference vs. Portals -Redoc Community Edition is free open-source software (OSS). -Redocly has developed extensive enhancements on top of Redoc Community Edition's open core, creating Redocly Reference Docs. -See [Comparison Redoc CE vs. Redocly Reference Docs](https://redoc.ly/redoc-vs-reference/) -for the main differences between the Redoc Community Edition and Redocly Reference Docs. +Redoc is Redocly's community-edition product. Looking for something more? +Checkout the following feature comparison of Redocly's premium products versus Redoc: -## Deploy to GitHub -[Deploy to Github](https://github.com/Rebilly/generator-openapi-repo#generator-openapi-repo--) +| Features | Redoc | Reference | Portals | +|------------------------------|:---------:|:---------:|:-----------:| +| **Specs** | | | | +| Swagger 2.0 | √ | √ | √ | +| OpenAPI 3.0 | √ | √ | √ | +| OpenAPI 3.1 | √ (basic) | √ | √ | +| | | | | +| **Theming** | | | | +| Fonts/colors | √ | √ | √ | +| Extra theme options | | √ | √ | +| | | | | +| **Performance** | | | | +| Pagination | | √ | √ | +| Search (enhanced) | | √ | √ | +| Search (server-side) | | | √ | +| | | | | +| **Multiple APIs** | | | | +| Multiple versions | | √ | √ | +| Multiple APIs | | | √ | +| API catalog | | | √ | +| | | | | +| **Additional features** | | | | +| Try-it console | | √ | √ | +| Automated code samples | | √ | √ | +| Deep links | | √ | √ | +| More SEO control | | | √ | +| Contextual docs | | | √ | +| Landing pages | | | √ | +| React hooks for more control | | | √ | +| Personalization | | | √ | +| Analytics integrations | | | √ | +| Feedback | | | Coming Soon | -## Redoc as a service -[Redoc as a service](https://redoc.ly/workflows) +Refer to the Redocly's documentation for more information on these products: + +- [Portals](https://redoc.ly/docs/developer-portal/introduction/) +- [Reference](https://redoc.ly/docs/api-reference-docs/getting-started/) +- [Redoc](https://redoc.ly/docs/redoc/quickstart/intro/) ## Features - Responsive three-panel design with menu/scrolling synchronization - [Multiple deployment options](https://redoc.ly/docs/redoc/quickstart/intro/) -- Deep linking support - [Server-side rendering (SSR) ready](https://redoc.ly/docs/redoc/quickstart/cli/#redoc-cli-commands) - Ability to integrate your API introduction into the side menu - [Simple integration with `create-react-app`](https://redoc.ly/docs/redoc/quickstart/react/) @@ -99,6 +129,14 @@ Additionally, all the 1.x releases are hosted on our GitHub Pages-based CDN **(d - [APIs.guru](https://apis.guru/api-doc/) - [BoxKnight](https://www.docs.boxknight.com/) +## Lint OpenAPI definitions + +Redocly's OpenAPI CLI is an open source command-line tool that you can use to lint +your OpenAPI definition. Linting helps you to catch errors and inconsistencies in your +OpenAPI definition before publishing. + +Refer to [Lint configuration](https://redoc.ly/docs/cli/guides/lint/) in the OpenAPI documentation for more information. + ## Deployment ### TL;DR final code example From 3cc6ea458973f7d8bb95e43687808c4743ebce39 Mon Sep 17 00:00:00 2001 From: Heather Cloward Date: Sat, 9 Oct 2021 14:44:37 -0400 Subject: [PATCH 10/25] Minor edit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5074978b..82f09b27 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
- ReDoc logo + Redoc logo # Generate interactive API documentation from OpenAPI definitions From c4564de324d78c86e4436cf7ee0aa5b8c63f48ca Mon Sep 17 00:00:00 2001 From: Heather Cloward Date: Sat, 9 Oct 2021 14:46:36 -0400 Subject: [PATCH 11/25] Updates image src --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82f09b27..3aad1e42 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
- Redoc logo + Redoc logo # Generate interactive API documentation from OpenAPI definitions From 35f77878de7d1dd250040771f17757a5a6ce85f9 Mon Sep 17 00:00:00 2001 From: Roman Marshevskyy Date: Mon, 11 Oct 2021 10:53:28 +0300 Subject: [PATCH 12/25] fix: OpenAPI 3.1: Missing description when $ref used #1727 --- src/services/OpenAPIParser.ts | 12 ++++++ src/services/__tests__/OpenAPIParser.test.ts | 14 +++++++ .../__snapshots__/OpenAPIParser.test.ts.snap | 7 ++++ .../fixtures/siblingRefDescription.json | 39 +++++++++++++++++++ src/services/models/Schema.ts | 2 +- 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 src/services/__tests__/fixtures/siblingRefDescription.json diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index 11a001aa..1683e927 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -174,6 +174,18 @@ export class OpenAPIParser { return obj; } + shallowDeref(obj: OpenAPIRef | T): T { + if (this.isRef(obj)) { + const schemaName = getDefinitionName(obj.$ref); + if (schemaName && this.options.ignoreNamedSchemas.has(schemaName)) { + return { type: 'object', title: schemaName } as T; + } + const resolved = this.byRef(obj.$ref); + return this.allowMergeRefs ? this.mergeRefs(obj, resolved, false) : (resolved as T); + } + return obj; + } + mergeRefs(ref, resolved, mergeAsAllOf: boolean) { // eslint-disable-next-line @typescript-eslint/no-unused-vars const { $ref, ...rest } = ref; diff --git a/src/services/__tests__/OpenAPIParser.test.ts b/src/services/__tests__/OpenAPIParser.test.ts index b79f61b4..b8b211ba 100644 --- a/src/services/__tests__/OpenAPIParser.test.ts +++ b/src/services/__tests__/OpenAPIParser.test.ts @@ -1,5 +1,6 @@ import { OpenAPIParser } from '../OpenAPIParser'; import { RedocNormalizedOptions } from '../RedocNormalizedOptions'; +import { OpenAPIParameter, Referenced } from '../../types'; const opts = new RedocNormalizedOptions({}); @@ -13,5 +14,18 @@ describe('Models', () => { parser = new OpenAPIParser(spec, undefined, opts); expect(parser.mergeAllOf(spec.components.schemas.test)).toMatchSnapshot(); }); + + test('should override description from $ref of the referenced component, when sibling description exists ', () => { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const spec = require('./fixtures/siblingRefDescription.json'); + parser = new OpenAPIParser(spec, undefined, opts); + const schemaOrRef: Referenced = { + $ref: '#/components/schemas/Test', + description: 'Overriden description', + }; + + expect(parser.shallowDeref(schemaOrRef)).toMatchSnapshot(); + }); + }); }); diff --git a/src/services/__tests__/__snapshots__/OpenAPIParser.test.ts.snap b/src/services/__tests__/__snapshots__/OpenAPIParser.test.ts.snap index 74a26ed0..ffbcbff5 100644 --- a/src/services/__tests__/__snapshots__/OpenAPIParser.test.ts.snap +++ b/src/services/__tests__/__snapshots__/OpenAPIParser.test.ts.snap @@ -86,3 +86,10 @@ Object { ], } `; + +exports[`Models Schema should override description from $ref of the referenced component, when sibling description exists 1`] = ` +Object { + "description": "Overriden description", + "type": "object", +} +`; diff --git a/src/services/__tests__/fixtures/siblingRefDescription.json b/src/services/__tests__/fixtures/siblingRefDescription.json new file mode 100644 index 00000000..b090a963 --- /dev/null +++ b/src/services/__tests__/fixtures/siblingRefDescription.json @@ -0,0 +1,39 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "AA", + "version": "1.0" + }, + "paths": { + "/test": { + "get": { + "operationId": "test", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "testAttr": { + "description": "Overriden description", + "$ref": "#/components/schemas/Test" + } + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Test": { + "type": "object", + "description": "Refed description" + } + } + } +} diff --git a/src/services/models/Schema.ts b/src/services/models/Schema.ts index d79d738b..1b23cf5f 100644 --- a/src/services/models/Schema.ts +++ b/src/services/models/Schema.ts @@ -78,7 +78,7 @@ export class SchemaModel { makeObservable(this); this.pointer = schemaOrRef.$ref || pointer || ''; - this.rawSchema = parser.deref(schemaOrRef, false, true); + this.rawSchema = parser.shallowDeref(schemaOrRef); this.schema = parser.mergeAllOf(this.rawSchema, this.pointer, isChild); this.init(parser, isChild); From fe6909ed80dd6053b48c30f63a2460614bf957a9 Mon Sep 17 00:00:00 2001 From: Roman Marshevskyy Date: Mon, 11 Oct 2021 11:51:17 +0300 Subject: [PATCH 13/25] fix: OpenAPI 3.1: Missing description when $ref used #1727 --- src/services/OpenAPIParser.ts | 7 ------- src/services/models/MediaType.ts | 2 +- src/utils/openapi.ts | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index 1683e927..399ce1d5 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -206,13 +206,6 @@ export class OpenAPIParser { } } - shalowDeref(obj: OpenAPIRef | T): T { - if (this.isRef(obj)) { - return this.byRef(obj.$ref)!; - } - return obj; - } - /** * Merge allOf constraints. * @param schema schema with allOF diff --git a/src/services/models/MediaType.ts b/src/services/models/MediaType.ts index 9e41d89a..25dae807 100644 --- a/src/services/models/MediaType.ts +++ b/src/services/models/MediaType.ts @@ -40,7 +40,7 @@ export class MediaTypeModel { this.examples = { default: new ExampleModel( parser, - { value: parser.shalowDeref(info.example) }, + { value: parser.shallowDeref(info.example) }, name, info.encoding, ), diff --git a/src/utils/openapi.ts b/src/utils/openapi.ts index ad267722..d0b081f5 100644 --- a/src/utils/openapi.ts +++ b/src/utils/openapi.ts @@ -505,13 +505,13 @@ export function mergeParams( ): Array> { const operationParamNames = {}; operationParams.forEach(param => { - param = parser.shalowDeref(param); + param = parser.shallowDeref(param); operationParamNames[param.name + '_' + param.in] = true; }); // filter out path params overridden by operation ones with the same name pathParams = pathParams.filter(param => { - param = parser.shalowDeref(param); + param = parser.shallowDeref(param); return !operationParamNames[param.name + '_' + param.in]; }); From 952c05c6b4b95fe6082611fed9e2f0913272b904 Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Mon, 11 Oct 2021 12:40:56 +0300 Subject: [PATCH 14/25] fix: improve publish action scripts (#1729) --- .github/workflows/demo-deploy-s3.yml | 42 ---------- .github/workflows/e2e-tests.yml | 12 +++ .github/workflows/publish-cli.yml | 115 +++++++++++++++++++++++++++ .github/workflows/publish.yml | 100 +++++++++++++++++++++++ .github/workflows/unit-tests.yml | 2 +- .travis.yml | 32 -------- 6 files changed, 228 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/demo-deploy-s3.yml create mode 100644 .github/workflows/e2e-tests.yml create mode 100644 .github/workflows/publish-cli.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/demo-deploy-s3.yml b/.github/workflows/demo-deploy-s3.yml deleted file mode 100644 index efb2ca19..00000000 --- a/.github/workflows/demo-deploy-s3.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Redoc demo CI/CD - -on: - push: - tags: - - v[0-9]*.[0-9]*.[0-9]* - -jobs: - build-and-unit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - run: npm ci - - run: npm run bundle - - run: npm test - deploy: - needs: build-and-unit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: cache node modules - uses: actions/cache@v1 - with: - path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS - key: npm-${{ hashFiles('package-lock.json') }} - restore-keys: | - npm-${{ hashFiles('package-lock.json') }} - npm- - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - name: Install dependencies - run: npm ci - - name: Build package - run: npm run build:demo - - name: Deploy to S3 bucket - run: npm run deploy:demo - - name: Invalidate - run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DEMO_DISTRIBUTION_ID }} --paths "/*" diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml new file mode 100644 index 00000000..514a3193 --- /dev/null +++ b/.github/workflows/e2e-tests.yml @@ -0,0 +1,12 @@ +name: Tests e2e + +on: [push] + +jobs: + build-and-e2e: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm ci + - run: npm run bundle + - run: npm run e2e diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml new file mode 100644 index 00000000..9bfa3fff --- /dev/null +++ b/.github/workflows/publish-cli.yml @@ -0,0 +1,115 @@ +name: Publish cli + +on: + push: + tags: + - v[0-9]*.[0-9]*.[0-9]* + + +jobs: + bundle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - name: Cache node modules + uses: actions/cache@v2 + with: + path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + npm-${{ hashFiles('package-lock.json') }} + npm- + - run: npm ci + - run: npm run bundle + - name: Store bundle artifact + uses: actions/upload-artifact@v2 + with: + name: bundles-cli + path: bundles + retention-days: 1 + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: npm ci + - run: npm test + e2e-tests: + needs: [bundle] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: npm ci + - name: Download bundled artifact + uses: actions/download-artifact@v2 + with: + name: bundles + path: bundles-cli + - run: npm run e2e + bundle-cli: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - name: Cache node modules + uses: actions/cache@v2 + with: + path: ~/.npm + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + npm-${{ hashFiles('package-lock.json') }} + npm- + - name: Install dependencies + run: npm ci + - name: Bundle + run: npm run compile:cli + - name: Store bundle artifact + uses: actions/upload-artifact@v2 + with: + name: cli + path: cli + retention-days: 1 + check-version-cli: + name: Check Version + runs-on: ubuntu-latest + needs: [bundle-cli, unit-tests, e2e-tests] + outputs: + changed: ${{ steps.check.outputs.changed }} + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up Node.js + uses: actions/setup-node@v2 + - name: Check if version has been updated + id: check + uses: EndBug/version-check@v2.0.1 + with: + file-name: ./cli/package.json + file-url: https://unpkg.com/redoc-cli/package.json + static-checking: localIsNew + publish-cli: + needs: [ check-version-cli ] + if: needs.check-version-cli.outputs.changed == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v1 + with: + node-version: "14.x" + - uses: actions/checkout@v2 + - name: Download cli bundled artifact + uses: actions/download-artifact@v2 + with: + name: cli + path: cli + - name: Cache node modules + uses: actions/cache@v2 + with: + path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + npm-${{ hashFiles('package-lock.json') }} + npm- + - name: Publish to NPM + run: cd cli/ && npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..d1c9ccbf --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,100 @@ +name: Publish + +on: + push: + tags: + - v[0-9]*.[0-9]*.[0-9]* + +jobs: + bundle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - name: Cache node modules + uses: actions/cache@v2 + with: + path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + npm-${{ hashFiles('package-lock.json') }} + npm- + - run: npm ci + - run: npm run bundle + - name: Store bundle artifact + uses: actions/upload-artifact@v2 + with: + name: bundles + path: bundles + retention-days: 1 + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: npm ci + - run: npm test + e2e-tests: + needs: [bundle] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - run: npm ci + - name: Download bundled artifact + uses: actions/download-artifact@v2 + with: + name: bundles + path: bundles + - run: npm run e2e + deploy-demo: + needs: [bundle, unit-tests, e2e-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + - name: Install dependencies + run: npm ci + - name: Download bundled artifacts + uses: actions/download-artifact@v2 + with: + name: bundles + path: bundles + - name: Build package + run: npm run build:demo + - name: Deploy to S3 bucket + run: npm run deploy:demo + - name: Invalidate + run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DEMO_DISTRIBUTION_ID }} --paths "/*" + publish: + needs: [bundle, unit-tests, e2e-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v1 + with: + node-version: "14.x" + - uses: actions/checkout@v2 + - name: Download bundled artifacts + uses: actions/download-artifact@v2 + with: + name: bundles + path: bundles + - name: Cache node modules + uses: actions/cache@v2 + with: + path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + npm-${{ hashFiles('package-lock.json') }} + npm- + - name: Before deploy + run: npm run declarations + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: After script + run: cat ./coverage/lcov.info | coveralls diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 09e54a63..a0a0bbd1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -9,4 +9,4 @@ jobs: - uses: actions/checkout@v1 - run: npm ci - run: npm run bundle - - run: npm test + - run: npm test \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 03ac1fa4..00000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: node_js -node_js: -- '12' -cache: - directories: - - "~/.cache" -env: - global: - - GH_REF: github.com/Redocly/redoc.git - - GIT_AUTHOR_EMAIL: redoc-bot@users.noreply.github.com - - GIT_AUTHOR_NAME: RedocBot - - secure: apiavCfCQngL9Een1m7MIXMf3bqO3rY4YY59TMBl/yFKi80CEsHPHhgVUkl6hC+aM5PeBt/vgjh37rHMX31j/pcSZ4Z8SO/4Bwr36iHfhSxSEuAQog8P07qWqH7wYYWGIVmF682stgl0fYF+GN92sx/6edFVzsWVECf2G7imtICKSTbhKGm3Dhn2JwGnhD7eyfgZ33omgiaswumdu0xABoXDfqSZR+16fC4Ap5rhv3fXO9ndvRNy1STn376nT+my6e86UrQL4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RqQxAwdiMATF5SKqyiC+bn5oc35mFgbRF8= - - secure: ela1tn4wkJQZ8O4iv+4pIZi5cebxeCStVF1tEUe6qa6WWgJYVXmS2tEv3QQ36NUBFrP58Y6yl10XguPnvj/2BCqcZI4FUBHh3BfiBoUtXxDCVKI5LtlniNiOFGUwfzEeYka8T51zFlcUXSCCaxHkRZbmBsIzeJ39UwTi5fy0qwLv9GgL0czhwm8I8sZ8gyWdGmqpXNFEsb9JP4ZA3mw2qpWkGpGAqQPD9XSCkU3LmX1/ltwsBMAgGYKLLo7vU8d5KV2c8L1Gnxfl6BvfmqUD/dsas/1rnk08rU2nez5ekuQa2tJRkDLOv8bqvrGRLjHSUa3yPuisC6SsDGSU7/3DcozZyYsz7WQ6WI8tYabyjqqeJTF1N8a5T3IbZaZNV1J4JHOO9Cb/y7gIg4edANg6tbe7MzZpdEPRBnw6OkdTdirpNsWQ/jnfpY1hn6mraQZz/q8yaz3W21NjbBJhVnvfh5gWLKQ3YAAziCBhmmrThFhUu0czz+G920MuFo477TBcxvlrE7CaNJ0Q6yYkDehEPOv3jvEs1QVHPwuRrlaLTbBhrlTICKZ58gdX30O8N4i0Xgp/v6qrC03bplnMQc8E/uC61wcVLJixnlZVp8FODpUvPjsxVFkpuNSOIAaiqcERmoiPXx05Epzmr78hjU5rYCx/1MmVoeB4gs9YO+4guD4= -addons: - chrome: stable - apt: - packages: - - libgconf-2-4 -before_script: npm run bundle -script: npm test && ([ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run e2e-ci || npm - run e2e) -after_script: cat ./coverage/lcov.info | coveralls -before_deploy: npm run compile:cli && npm run declarations -deploy: -- provider: npm - skip_cleanup: true - email: gotsijroman@gmail.com - tag: next - api_key: "$NPM_TOKEN" - on: - tags: true From 43451ba4cd24270b8629a967d3fd2ce2eed8912e Mon Sep 17 00:00:00 2001 From: kylenarocroc <3884351+kylenarocroc@users.noreply.github.com> Date: Mon, 11 Oct 2021 10:50:09 +0100 Subject: [PATCH 15/25] feat: add q/kdb+ syntax highlighting (#1605) --- src/utils/highlight.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/highlight.ts b/src/utils/highlight.ts index 036b9129..23cdd43d 100644 --- a/src/utils/highlight.ts +++ b/src/utils/highlight.ts @@ -15,6 +15,7 @@ import 'prismjs/components/prism-objectivec.js'; import 'prismjs/components/prism-perl.js'; import 'prismjs/components/prism-php.js'; import 'prismjs/components/prism-python.js'; +import 'prismjs/components/prism-q.js'; import 'prismjs/components/prism-ruby.js'; import 'prismjs/components/prism-scala.js'; import 'prismjs/components/prism-sql.js'; From 3b8d6441bd9978b849a53021d40fd4fe150272ea Mon Sep 17 00:00:00 2001 From: Andriy Zaleskyy Date: Mon, 11 Oct 2021 13:05:50 +0300 Subject: [PATCH 16/25] fix: The number of items in the array in the array is incorrect #1762 (#1763) --- demo/openapi-3-1.yaml | 14 ++++++++++++ demo/openapi.yaml | 2 ++ src/components/Schema/ArraySchema.tsx | 13 +++++------ .../DiscriminatorDropdown.test.tsx.snap | 4 ++++ src/services/models/Schema.ts | 4 ++++ .../loadAndBundleSpec.test.ts.snap | 22 +++++++++++++++++++ src/utils/__tests__/openapi.test.ts | 8 +++---- 7 files changed, 55 insertions(+), 12 deletions(-) diff --git a/demo/openapi-3-1.yaml b/demo/openapi-3-1.yaml index 31063d4b..ac89619d 100644 --- a/demo/openapi-3-1.yaml +++ b/demo/openapi-3-1.yaml @@ -533,6 +533,20 @@ paths: subscriptionId: type: string example: AAA-123-BBB-456 + '200': + description: Successful operation + content: + application/json: + schema: + type: array + maxItems: 999 + minItems: 0 + items: + type: array + maxItems: 777 + minItems: 111 + items: + type: number callbacks: orderInProgress: '{$request.body#/callbackUrl}?event={$request.body#/eventName}': diff --git a/demo/openapi.yaml b/demo/openapi.yaml index c570cc60..5cf19340 100644 --- a/demo/openapi.yaml +++ b/demo/openapi.yaml @@ -377,7 +377,9 @@ paths: application/xml: schema: type: array + maxItems: 999 items: + maxItems: 111 $ref: '#/components/schemas/Pet' '400': description: Invalid tag value diff --git a/src/components/Schema/ArraySchema.tsx b/src/components/Schema/ArraySchema.tsx index eab37595..0b555c07 100644 --- a/src/components/Schema/ArraySchema.tsx +++ b/src/components/Schema/ArraySchema.tsx @@ -13,15 +13,12 @@ const PaddedSchema = styled.div` export class ArraySchema extends React.PureComponent { render() { - const itemsSchema = this.props.schema.items!; const schema = this.props.schema; + const itemsSchema = schema.items; - const itemConstraintSchema = ( - min: number | undefined = undefined, - max: number | undefined = undefined, - ) => ({ type: 'array', minItems: min, maxItems: max }); - - const minMaxItems = humanizeConstraints(itemConstraintSchema(itemsSchema?.schema?.minItems, itemsSchema?.schema?.maxItems)); + const minMaxItems = schema.minItems === undefined && schema.maxItems === undefined ? + '' : + `(${humanizeConstraints(schema)})`; if (schema.displayType && !itemsSchema && !minMaxItems.length) { return (
@@ -31,7 +28,7 @@ export class ArraySchema extends React.PureComponent { return (
- Array ({minMaxItems}) + Array {minMaxItems} diff --git a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap index fe5617ed..7af7b482 100644 --- a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap @@ -33,6 +33,8 @@ exports[`Components SchemaView discriminator should correctly render discriminat "format": undefined, "isCircular": undefined, "isPrimitive": true, + "maxItems": undefined, + "minItems": undefined, "options": "<<>>", "pattern": undefined, "pointer": "#/components/schemas/Dog/properties/packSize", @@ -86,6 +88,8 @@ exports[`Components SchemaView discriminator should correctly render discriminat "format": undefined, "isCircular": undefined, "isPrimitive": true, + "maxItems": undefined, + "minItems": undefined, "options": "<<>>", "pattern": undefined, "pointer": "#/components/schemas/Dog/properties/type", diff --git a/src/services/models/Schema.ts b/src/services/models/Schema.ts index 1b23cf5f..81dc7ee3 100644 --- a/src/services/models/Schema.ts +++ b/src/services/models/Schema.ts @@ -63,6 +63,8 @@ export class SchemaModel { const: any; contentEncoding?: string; contentMediaType?: string; + minItems?: number; + maxItems?: number; /** * @param isChild if schema discriminator Child @@ -128,6 +130,8 @@ export class SchemaModel { this.const = schema.const || ''; this.contentEncoding = schema.contentEncoding; this.contentMediaType = schema.contentMediaType; + this.minItems = schema.minItems; + this.maxItems = schema.maxItems; if (!!schema.nullable || schema['x-nullable']) { if (Array.isArray(this.type) && !this.type.some((value) => value === null || value === 'null')) { diff --git a/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap b/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap index 7807e39e..6cd0a034 100644 --- a/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap +++ b/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap @@ -729,7 +729,9 @@ try { "schema": Object { "items": Object { "$ref": "#/components/schemas/Pet", + "maxItems": 111, }, + "maxItems": 999, "type": "array", }, }, @@ -3245,6 +3247,26 @@ culpa qui officia deserunt mollit anim id est laborum. }, }, "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "items": Object { + "type": "number", + }, + "maxItems": 777, + "minItems": 111, + "type": "array", + }, + "maxItems": 999, + "minItems": 0, + "type": "array", + }, + }, + }, + "description": "Successful operation", + }, "201": Object { "content": Object { "application/json": Object { diff --git a/src/utils/__tests__/openapi.test.ts b/src/utils/__tests__/openapi.test.ts index d4f23e02..6f40d974 100644 --- a/src/utils/__tests__/openapi.test.ts +++ b/src/utils/__tests__/openapi.test.ts @@ -412,10 +412,10 @@ describe('Utils', () => { describe('openapi humanizeConstraints', () => { const itemConstraintSchema = ( - min: number | undefined = undefined, - max: number | undefined = undefined, - multipleOf: number | undefined = undefined, - uniqueItems?: boolean, + min?: number, + max?: number, + multipleOf?: number, + uniqueItems?: boolean ) => ({ type: 'array', minItems: min, maxItems: max, multipleOf, uniqueItems }); it('should not have a humanized constraint without schema constraints', () => { From 4fb9c835256b9e44bcecabde7baf0f0f3e5beb3f Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 11 Oct 2021 15:02:08 +0300 Subject: [PATCH 17/25] fix: fix deref logic for oas3.1 (#1767) --- src/services/OpenAPIParser.ts | 2 +- src/services/models/Schema.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index 399ce1d5..4881c99e 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -195,7 +195,7 @@ export class OpenAPIParser { } if (mergeAsAllOf && keys.some((k) => k !== 'description' && k !== 'title' && k !== 'externalDocs')) { return { - allOf: [resolved, rest], + allOf: [rest, resolved], }; } else { // small optimization diff --git a/src/services/models/Schema.ts b/src/services/models/Schema.ts index 81dc7ee3..b155d254 100644 --- a/src/services/models/Schema.ts +++ b/src/services/models/Schema.ts @@ -80,7 +80,7 @@ export class SchemaModel { makeObservable(this); this.pointer = schemaOrRef.$ref || pointer || ''; - this.rawSchema = parser.shallowDeref(schemaOrRef); + this.rawSchema = parser.deref(schemaOrRef, false, true); this.schema = parser.mergeAllOf(this.rawSchema, this.pointer, isChild); this.init(parser, isChild); @@ -363,7 +363,7 @@ function buildFields( ): FieldModel[] { const props = schema.properties || {}; const additionalProps = schema.additionalProperties; - const defaults = schema.default || {}; + const defaults = schema.default; let fields = Object.keys(props || []).map((fieldName) => { let field = props[fieldName]; @@ -384,7 +384,7 @@ function buildFields( required, schema: { ...field, - default: field.default === undefined ? defaults[fieldName] : field.default, + default: field.default === undefined && defaults ? defaults[fieldName] : field.default, }, }, $ref + '/properties/' + fieldName, From 8e75f9929bfffb873cfd7ce51788319b314392bd Mon Sep 17 00:00:00 2001 From: Gabriel Simon Gianotti Date: Mon, 11 Oct 2021 11:30:59 -0300 Subject: [PATCH 18/25] chore: remove commented out code (#1768) --- src/common-elements/fields-layout.ts | 2 -- src/components/Responses/styled.elements.ts | 2 -- src/components/SecurityRequirement/SecurityRequirement.tsx | 1 - src/components/SideMenu/MenuItem.tsx | 1 - 4 files changed, 6 deletions(-) diff --git a/src/common-elements/fields-layout.ts b/src/common-elements/fields-layout.ts index 5b9a578f..8738b014 100644 --- a/src/common-elements/fields-layout.ts +++ b/src/common-elements/fields-layout.ts @@ -1,5 +1,3 @@ -// import { transparentize } from 'polished'; - import styled, { extensionsHook, media } from '../styled-components'; import { deprecatedCss } from './mixins'; diff --git a/src/components/Responses/styled.elements.ts b/src/components/Responses/styled.elements.ts index a592d4b5..92b790c2 100644 --- a/src/components/Responses/styled.elements.ts +++ b/src/components/Responses/styled.elements.ts @@ -1,5 +1,3 @@ -// import { transparentize } from 'polished'; - import { UnderlinedHeader } from '../../common-elements'; import styled from '../../styled-components'; import { ResponseTitle } from './ResponseTitle'; diff --git a/src/components/SecurityRequirement/SecurityRequirement.tsx b/src/components/SecurityRequirement/SecurityRequirement.tsx index 91bf9f43..fb45fed2 100644 --- a/src/components/SecurityRequirement/SecurityRequirement.tsx +++ b/src/components/SecurityRequirement/SecurityRequirement.tsx @@ -1,4 +1,3 @@ -// import { transparentize } from 'polished'; import * as React from 'react'; import styled, { media } from '../../styled-components'; diff --git a/src/components/SideMenu/MenuItem.tsx b/src/components/SideMenu/MenuItem.tsx index 9a19fa07..4597bec6 100644 --- a/src/components/SideMenu/MenuItem.tsx +++ b/src/components/SideMenu/MenuItem.tsx @@ -1,4 +1,3 @@ -// import { observe } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; From 352a8518576dfb6b240ec41212a64f1c7312ab67 Mon Sep 17 00:00:00 2001 From: raghavi92 Date: Mon, 11 Oct 2021 20:04:20 +0530 Subject: [PATCH 19/25] fix: No match scenario in search (#1667) Co-authored-by: Alex Varchuk --- e2e/integration/search.e2e.ts | 6 ++++++ src/components/SearchBox/SearchBox.tsx | 9 +++++++++ src/services/Labels.ts | 2 ++ 3 files changed, 17 insertions(+) diff --git a/e2e/integration/search.e2e.ts b/e2e/integration/search.e2e.ts index a44cafb7..b1a7d4a7 100644 --- a/e2e/integration/search.e2e.ts +++ b/e2e/integration/search.e2e.ts @@ -53,4 +53,10 @@ describe('Search', () => { getSearchInput().type('int', { force: true }); cy.get('[data-markjs]').should('exist'); }); + + it('should show proper message when no search results are found', () => { + getSearchResults().should('not.exist'); + getSearchInput().type('xzss', {force: true}); + getSearchResults().should('exist').should('contain', 'No results found'); + }) }); diff --git a/src/components/SearchBox/SearchBox.tsx b/src/components/SearchBox/SearchBox.tsx index 21900862..f0427eb8 100644 --- a/src/components/SearchBox/SearchBox.tsx +++ b/src/components/SearchBox/SearchBox.tsx @@ -16,6 +16,7 @@ import { SearchResultsBox, SearchWrap, } from './styled.elements'; +import { l } from '../../services/Labels'; export interface SearchBoxProps { search: SearchStore; @@ -28,6 +29,7 @@ export interface SearchBoxProps { export interface SearchBoxState { results: SearchResult[]; + noResults: boolean; term: string; activeItemIdx: number; } @@ -39,6 +41,7 @@ export class SearchBox extends React.PureComponent { this.setState({ results: [], + noResults: false, term: '', activeItemIdx: -1, }); @@ -95,6 +100,7 @@ export class SearchBox extends React.PureComponent )} + {this.state.term && this.state.noResults ? ( + {l('noResultsFound')} + ) : null} ); } diff --git a/src/services/Labels.ts b/src/services/Labels.ts index 71b83e58..378ef143 100644 --- a/src/services/Labels.ts +++ b/src/services/Labels.ts @@ -10,6 +10,7 @@ export interface LabelsConfig { arrayOf: string; webhook: string; const: string; + noResultsFound: string; download: string; downloadSpecification: string; responses: string; @@ -32,6 +33,7 @@ const labels: LabelsConfig = { arrayOf: 'Array of ', webhook: 'Event', const: 'Value', + noResultsFound: 'No results found', download: 'Download', downloadSpecification: 'Download OpenAPI specification', responses: 'Responses', From e621535dc72ecb1b9e7eab6e53f2765b544d26aa Mon Sep 17 00:00:00 2001 From: AlexVarchuk Date: Mon, 11 Oct 2021 17:56:29 +0300 Subject: [PATCH 20/25] chore: v2.0.0-rc.57 (#1770) --- CHANGELOG.md | 23 +++++++++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b73fb105..0ee0e446 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +# [2.0.0-rc.57](https://github.com/Redocly/redoc/compare/v2.0.0-rc.56...v2.0.0-rc.57) (2021-10-11) + + +### Bug Fixes + +* fix deref logic for oas3.1 ([#1767](https://github.com/Redocly/redoc/issues/1767)) ([4fb9c83](https://github.com/Redocly/redoc/commit/4fb9c835256b9e44bcecabde7baf0f0f3e5beb3f)) +* improve publish action scripts ([#1729](https://github.com/Redocly/redoc/issues/1729)) ([952c05c](https://github.com/Redocly/redoc/commit/952c05c6b4b95fe6082611fed9e2f0913272b904)) +* No match scenario in search ([#1667](https://github.com/Redocly/redoc/issues/1667)) ([352a851](https://github.com/Redocly/redoc/commit/352a8518576dfb6b240ec41212a64f1c7312ab67)) +* OpenAPI 3.1: Missing description when $ref used [#1727](https://github.com/Redocly/redoc/issues/1727) ([fe6909e](https://github.com/Redocly/redoc/commit/fe6909ed80dd6053b48c30f63a2460614bf957a9)) +* OpenAPI 3.1: Missing description when $ref used [#1727](https://github.com/Redocly/redoc/issues/1727) ([35f7787](https://github.com/Redocly/redoc/commit/35f77878de7d1dd250040771f17757a5a6ce85f9)) +* Redoc spelling ([c87600d](https://github.com/Redocly/redoc/commit/c87600d520f037d291169b44b5803a35af16b5a5)) +* Schema for events incorrectly omits readOnly and includes writeOnly ([#1720](https://github.com/Redocly/redoc/issues/1720) [#1540](https://github.com/Redocly/redoc/issues/1540)) ([a8e0c29](https://github.com/Redocly/redoc/commit/a8e0c296852661dec1dcad2388d7589f9e0d3609)) +* scrolling to the first item ([#1753](https://github.com/Redocly/redoc/issues/1753)) ([bccd213](https://github.com/Redocly/redoc/commit/bccd21394ef79940c2efbe24a0d866c7af103d94)) +* The number of items in the array in the array is incorrect [#1762](https://github.com/Redocly/redoc/issues/1762) ([#1763](https://github.com/Redocly/redoc/issues/1763)) ([3b8d644](https://github.com/Redocly/redoc/commit/3b8d6441bd9978b849a53021d40fd4fe150272ea)) + + +### Features + +* add q/kdb+ syntax highlighting ([#1605](https://github.com/Redocly/redoc/issues/1605)) ([43451ba](https://github.com/Redocly/redoc/commit/43451ba4cd24270b8629a967d3fd2ce2eed8912e)) +* new option generatedPayloadSamplesMaxDepth ([#1642](https://github.com/Redocly/redoc/issues/1642)) ([bd9390a](https://github.com/Redocly/redoc/commit/bd9390a5bfc5458c06121110db33968a20fcebe4)) + + + # [2.0.0-rc.56](https://github.com/Redocly/redoc/compare/v2.0.0-rc.53...v2.0.0-rc.56) (2021-08-11) diff --git a/package-lock.json b/package-lock.json index 41b9dcc2..9e8aca4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "redoc", - "version": "2.0.0-rc.56", + "version": "2.0.0-rc.57", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "2.0.0-rc.56", + "version": "2.0.0-rc.57", "license": "MIT", "dependencies": { "@babel/runtime": "^7.14.0", diff --git a/package.json b/package.json index b4fb9912..905992a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redoc", - "version": "2.0.0-rc.56", + "version": "2.0.0-rc.57", "description": "ReDoc", "repository": { "type": "git", From aeb276aaf1f2873ee76ef00b3ded24a4605b3b9e Mon Sep 17 00:00:00 2001 From: romanhotsiy Date: Mon, 11 Oct 2021 18:23:26 +0300 Subject: [PATCH 21/25] chore: update publish cli workflow --- .github/workflows/publish-cli.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index 9bfa3fff..9d7818ef 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -2,12 +2,14 @@ name: Publish cli on: push: - tags: - - v[0-9]*.[0-9]*.[0-9]* + branches: + - master jobs: bundle: + needs: [ check-version-cli ] + if: needs.check-version-cli.outputs.changed == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -29,13 +31,15 @@ jobs: path: bundles retention-days: 1 unit-tests: + needs: [ check-version-cli ] + if: needs.check-version-cli.outputs.changed == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - run: npm ci - run: npm test e2e-tests: - needs: [bundle] + needs: [ bundle ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -43,10 +47,12 @@ jobs: - name: Download bundled artifact uses: actions/download-artifact@v2 with: - name: bundles - path: bundles-cli + name: bundles-cli + path: bundles - run: npm run e2e bundle-cli: + needs: [ check-version-cli ] + if: needs.check-version-cli.outputs.changed == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -72,7 +78,6 @@ jobs: check-version-cli: name: Check Version runs-on: ubuntu-latest - needs: [bundle-cli, unit-tests, e2e-tests] outputs: changed: ${{ steps.check.outputs.changed }} steps: @@ -88,7 +93,7 @@ jobs: file-url: https://unpkg.com/redoc-cli/package.json static-checking: localIsNew publish-cli: - needs: [ check-version-cli ] + needs: [bundle-cli, unit-tests, e2e-tests] if: needs.check-version-cli.outputs.changed == 'true' runs-on: ubuntu-latest steps: From 56543d239e09813de53cb092dd6ae8a006e7b378 Mon Sep 17 00:00:00 2001 From: romanhotsiy Date: Mon, 11 Oct 2021 18:32:43 +0300 Subject: [PATCH 22/25] chore: fix publish workflow and disable s3 demo --- .github/workflows/publish.yml | 51 ++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d1c9ccbf..5da7f70a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,30 +45,31 @@ jobs: name: bundles path: bundles - run: npm run e2e - deploy-demo: - needs: [bundle, unit-tests, e2e-tests] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - name: Install dependencies - run: npm ci - - name: Download bundled artifacts - uses: actions/download-artifact@v2 - with: - name: bundles - path: bundles - - name: Build package - run: npm run build:demo - - name: Deploy to S3 bucket - run: npm run deploy:demo - - name: Invalidate - run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DEMO_DISTRIBUTION_ID }} --paths "/*" + # disable this for now + # deploy-demo: + # needs: [bundle, unit-tests, e2e-tests] + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v1 + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v1 + # with: + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + # aws-region: us-east-1 + # - name: Install dependencies + # run: npm ci + # - name: Download bundled artifacts + # uses: actions/download-artifact@v2 + # with: + # name: bundles + # path: bundles + # - name: Build package + # run: npm run build:demo + # - name: Deploy to S3 bucket + # run: npm run deploy:demo + # - name: Invalidate + # run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DEMO_DISTRIBUTION_ID }} --paths "/*" publish: needs: [bundle, unit-tests, e2e-tests] runs-on: ubuntu-latest @@ -91,7 +92,7 @@ jobs: npm-${{ hashFiles('package-lock.json') }} npm- - name: Before deploy - run: npm run declarations + run: npm ci && npm run declarations - name: Publish to NPM run: npm publish env: From e4f34f5363b5c6c9e8e5b104f29d5cab13df7e4c Mon Sep 17 00:00:00 2001 From: romanhotsiy Date: Mon, 11 Oct 2021 20:39:20 +0300 Subject: [PATCH 23/25] chore: fix publish workflow again --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5da7f70a..debe2cb8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -77,6 +77,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: "14.x" + registry-url: 'https://registry.npmjs.org' - uses: actions/checkout@v2 - name: Download bundled artifacts uses: actions/download-artifact@v2 From 7b1a720942c0049d2f35ae5559c5911529a47021 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 11 Oct 2021 20:53:41 +0300 Subject: [PATCH 24/25] chore(cli): v0.13.0 (#1771) --- .github/workflows/publish.yml | 2 - cli/npm-shrinkwrap.json | 125 +++++++++++++++++----------------- cli/package.json | 4 +- 3 files changed, 66 insertions(+), 65 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index debe2cb8..b6d05316 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -98,5 +98,3 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: After script - run: cat ./coverage/lcov.info | coveralls diff --git a/cli/npm-shrinkwrap.json b/cli/npm-shrinkwrap.json index 117d9c06..c5d3ac14 100644 --- a/cli/npm-shrinkwrap.json +++ b/cli/npm-shrinkwrap.json @@ -1,12 +1,12 @@ { "name": "redoc-cli", - "version": "0.12.3", + "version": "0.13.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "redoc-cli", - "version": "0.12.3", + "version": "0.13.0", "license": "MIT", "dependencies": { "chokidar": "^3.5.1", @@ -17,7 +17,7 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.56", + "redoc": "2.0.0-rc.57", "styled-components": "^5.3.0", "yargs": "^17.0.1" }, @@ -198,13 +198,13 @@ "integrity": "sha512-GoXw0U2Qaa33m3eUcxuHnHpNvHjNlLo0gtV091XBpaRINaB4X6FGCG5XKxSFNFiPpugUDqNruHzaqpTdDm4AOg==" }, "node_modules/@redocly/ajv": { - "version": "6.12.4", - "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-6.12.4.tgz", - "integrity": "sha512-RB6vWO78v6c+SW/3bZh+XZMr4nGdJKAiPGsBALuUZnLuCiQ7aXCT1AuFHqnfS2gyXbEUEj+kw8p4ux8KdAfs3A==", + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.6.2.tgz", + "integrity": "sha512-tU8fQs0D76ZKhJ2cWtnfQthWqiZgGBx0gH0+5D8JvaBEBaqA8foPPBt3Nonwr3ygyv5xrw2IzKWgIY86BlGs+w==", "dependencies": { "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", "uri-js": "^4.2.2" }, "funding": { @@ -213,11 +213,11 @@ } }, "node_modules/@redocly/openapi-core": { - "version": "1.0.0-beta.50", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.50.tgz", - "integrity": "sha512-GuXn4IETxpbRd8dlAQDQPtvqOpbMvPMeC/e5mv5MOXkLIznNk4vjiQVe6QSCbZbCHzzpb2+89B6S7asebPm4Rg==", + "version": "1.0.0-beta.62", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.62.tgz", + "integrity": "sha512-g4iPB7qpSNFCOpf/FgKiic+QCaCn4mdNQOWVEPuwpN7l72hlQ7J3YUa9cssJomkJXXxZ1zdP4h208s12LkhwVA==", "dependencies": { - "@redocly/ajv": "^6.12.3", + "@redocly/ajv": "^8.6.2", "@types/node": "^14.11.8", "colorette": "^1.2.0", "js-levenshtein": "^1.1.6", @@ -232,9 +232,9 @@ } }, "node_modules/@redocly/openapi-core/node_modules/@types/node": { - "version": "14.17.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.3.tgz", - "integrity": "sha512-e6ZowgGJmTuXa3GyaPbTGxX17tnThl2aSSizrFthQ7m9uLGZBXiGhgE55cjRZTF5kjZvYn9EOPOMljdjwbflxw==" + "version": "14.17.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.21.tgz", + "integrity": "sha512-zv8ukKci1mrILYiQOwGSV4FpkZhyxQtuFWGya2GujWg+zVAeRQ4qbaMmWp9vb9889CFA8JECH7lkwCL6Ygg8kA==" }, "node_modules/@redocly/react-dropdown-aria": { "version": "2.0.12", @@ -283,7 +283,8 @@ "node_modules/@types/node": { "version": "15.12.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.2.tgz", - "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==" + "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==", + "dev": true }, "node_modules/ansi-regex": { "version": "5.0.0", @@ -637,9 +638,9 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, "node_modules/colorette": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", - "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==" }, "node_modules/concat-map": { "version": "0.0.1", @@ -893,11 +894,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, "node_modules/fast-safe-stringify": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", @@ -1175,9 +1171,9 @@ } }, "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/lodash": { "version": "4.17.21", @@ -1751,14 +1747,13 @@ } }, "node_modules/redoc": { - "version": "2.0.0-rc.56", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.56.tgz", - "integrity": "sha512-ir2TtQ2d/1FqZWIoLmUZ3qvAAnO6jg8dt0SV75TanmfCXpEABcElXWH3mtUf6qKlvgDVt40diDCVuSvyPPxkAw==", + "version": "2.0.0-rc.57", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.57.tgz", + "integrity": "sha512-f8XIqvZF1agphq6xmOU9jTDVNDFHJt3MzDq1lUgZojb/7YY4eqLyDi6er/yCWYkY9DuB+v2jHCOn5UUbMuKAfg==", "dependencies": { "@babel/runtime": "^7.14.0", - "@redocly/openapi-core": "^1.0.0-beta.50", + "@redocly/openapi-core": "^1.0.0-beta.54", "@redocly/react-dropdown-aria": "^2.0.11", - "@types/node": "^15.6.1", "classnames": "^2.3.1", "decko": "^1.2.0", "dompurify": "^2.2.8", @@ -1819,6 +1814,14 @@ "node": ">=0.10.0" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ripemd160": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", @@ -2451,22 +2454,22 @@ "integrity": "sha512-GoXw0U2Qaa33m3eUcxuHnHpNvHjNlLo0gtV091XBpaRINaB4X6FGCG5XKxSFNFiPpugUDqNruHzaqpTdDm4AOg==" }, "@redocly/ajv": { - "version": "6.12.4", - "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-6.12.4.tgz", - "integrity": "sha512-RB6vWO78v6c+SW/3bZh+XZMr4nGdJKAiPGsBALuUZnLuCiQ7aXCT1AuFHqnfS2gyXbEUEj+kw8p4ux8KdAfs3A==", + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.6.2.tgz", + "integrity": "sha512-tU8fQs0D76ZKhJ2cWtnfQthWqiZgGBx0gH0+5D8JvaBEBaqA8foPPBt3Nonwr3ygyv5xrw2IzKWgIY86BlGs+w==", "requires": { "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", "uri-js": "^4.2.2" } }, "@redocly/openapi-core": { - "version": "1.0.0-beta.50", - "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.50.tgz", - "integrity": "sha512-GuXn4IETxpbRd8dlAQDQPtvqOpbMvPMeC/e5mv5MOXkLIznNk4vjiQVe6QSCbZbCHzzpb2+89B6S7asebPm4Rg==", + "version": "1.0.0-beta.62", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.0.0-beta.62.tgz", + "integrity": "sha512-g4iPB7qpSNFCOpf/FgKiic+QCaCn4mdNQOWVEPuwpN7l72hlQ7J3YUa9cssJomkJXXxZ1zdP4h208s12LkhwVA==", "requires": { - "@redocly/ajv": "^6.12.3", + "@redocly/ajv": "^8.6.2", "@types/node": "^14.11.8", "colorette": "^1.2.0", "js-levenshtein": "^1.1.6", @@ -2478,9 +2481,9 @@ }, "dependencies": { "@types/node": { - "version": "14.17.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.3.tgz", - "integrity": "sha512-e6ZowgGJmTuXa3GyaPbTGxX17tnThl2aSSizrFthQ7m9uLGZBXiGhgE55cjRZTF5kjZvYn9EOPOMljdjwbflxw==" + "version": "14.17.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.21.tgz", + "integrity": "sha512-zv8ukKci1mrILYiQOwGSV4FpkZhyxQtuFWGya2GujWg+zVAeRQ4qbaMmWp9vb9889CFA8JECH7lkwCL6Ygg8kA==" } } }, @@ -2525,7 +2528,8 @@ "@types/node": { "version": "15.12.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.2.tgz", - "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==" + "integrity": "sha512-zjQ69G564OCIWIOHSXyQEEDpdpGl+G348RAKY0XXy9Z5kU9Vzv1GMNnkar/ZJ8dzXB3COzD9Mo9NtRZ4xfgUww==", + "dev": true }, "ansi-regex": { "version": "5.0.0", @@ -2841,9 +2845,9 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, "colorette": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", - "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==" }, "concat-map": { "version": "0.0.1", @@ -3064,11 +3068,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, "fast-safe-stringify": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", @@ -3273,9 +3272,9 @@ } }, "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "lodash": { "version": "4.17.21", @@ -3741,14 +3740,13 @@ } }, "redoc": { - "version": "2.0.0-rc.56", - "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.56.tgz", - "integrity": "sha512-ir2TtQ2d/1FqZWIoLmUZ3qvAAnO6jg8dt0SV75TanmfCXpEABcElXWH3mtUf6qKlvgDVt40diDCVuSvyPPxkAw==", + "version": "2.0.0-rc.57", + "resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.57.tgz", + "integrity": "sha512-f8XIqvZF1agphq6xmOU9jTDVNDFHJt3MzDq1lUgZojb/7YY4eqLyDi6er/yCWYkY9DuB+v2jHCOn5UUbMuKAfg==", "requires": { "@babel/runtime": "^7.14.0", - "@redocly/openapi-core": "^1.0.0-beta.50", + "@redocly/openapi-core": "^1.0.0-beta.54", "@redocly/react-dropdown-aria": "^2.0.11", - "@types/node": "^15.6.1", "classnames": "^2.3.1", "decko": "^1.2.0", "dompurify": "^2.2.8", @@ -3794,6 +3792,11 @@ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + }, "ripemd160": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", diff --git a/cli/package.json b/cli/package.json index 379f5cfe..c5289576 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "redoc-cli", - "version": "0.12.3", + "version": "0.13.0", "description": "ReDoc's Command Line Interface", "main": "index.js", "bin": "index.js", @@ -19,7 +19,7 @@ "node-libs-browser": "^2.2.1", "react": "^17.0.1", "react-dom": "^17.0.1", - "redoc": "2.0.0-rc.56", + "redoc": "2.0.0-rc.57", "styled-components": "^5.3.0", "yargs": "^17.0.1" }, From ebbd256b1fe1256ebfd81787482f06e6f3b9c67d Mon Sep 17 00:00:00 2001 From: romanhotsiy Date: Mon, 11 Oct 2021 21:00:54 +0300 Subject: [PATCH 25/25] chore: fix cli publish workflow --- .github/workflows/publish-cli.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-cli.yml b/.github/workflows/publish-cli.yml index 9d7818ef..ea39efae 100644 --- a/.github/workflows/publish-cli.yml +++ b/.github/workflows/publish-cli.yml @@ -100,6 +100,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: "14.x" + registry-url: 'https://registry.npmjs.org' - uses: actions/checkout@v2 - name: Download cli bundled artifact uses: actions/download-artifact@v2