mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-07 13:44:54 +03:00
Merge branch 'Redocly:master' into fix-openapi-security
This commit is contained in:
commit
85ac2d169c
|
@ -3,20 +3,29 @@
|
||||||
**[ReDoc](https://github.com/Redocly/redoc)'s Command Line Interface**
|
**[ReDoc](https://github.com/Redocly/redoc)'s Command Line Interface**
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
You can use redoc cli by installing `redoc-cli` globally or using [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b).
|
|
||||||
|
You can use `redoc-cli` by installing [the package](https://www.npmjs.com/package/redoc-cli) globally,
|
||||||
|
or using [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Two following commands are available:
|
The two following commands are available:
|
||||||
|
|
||||||
- `redoc-cli serve [spec]` - starts the server with `spec` rendered with ReDoc. Supports SSR mode (`--ssr`) and can watch the spec (`--watch`)
|
- `redoc-cli serve [spec]` - starts the server with `spec` rendered with ReDoc.
|
||||||
- `redoc-cli bundle [spec]` - bundles spec and ReDoc into **zero-dependency** HTML file.
|
Supports a server-side rendering mode (`--ssr`),
|
||||||
|
and can watch the spec (`--watch`) to automatically reload the page whenever it changes.
|
||||||
|
- `redoc-cli bundle [spec]` - bundles `spec` and ReDoc into a **zero-dependency** HTML file.
|
||||||
|
|
||||||
Some examples:
|
Some examples:
|
||||||
|
|
||||||
- Bundle with main color changed to `orange`: <br> `$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange`
|
- Bundle with the main color changed to `orange`:<br/>
|
||||||
- Serve with `nativeScrollbars` option set to true: <br> `$ redoc-cli serve [spec] --options.nativeScrollbars`
|
`$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange`
|
||||||
- Bundle using custom template (check [default template](https://github.com/Redocly/redoc/blob/master/cli/template.hbs) for reference): <br> `$ redoc-cli bundle [spec] -t custom.hbs`
|
- Serve with the `nativeScrollbars` option set to true:<br/>
|
||||||
- Bundle using custom template and add custom `templateOptions`: <br> `$ redoc-cli bundle [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"`
|
`$ redoc-cli serve [spec] --options.nativeScrollbars`
|
||||||
|
- Bundle using a custom [Handlebars](https://handlebarsjs.com/) template
|
||||||
|
(check the [default template](https://github.com/Redocly/redoc/blob/master/cli/template.hbs) for an example):<br/>
|
||||||
|
`$ redoc-cli bundle [spec] -t custom.hbs`
|
||||||
|
- Bundle using a custom template and add custom `templateOptions`:<br/>
|
||||||
|
`$ redoc-cli bundle [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"`
|
||||||
|
|
||||||
For more details run `redoc-cli --help`.
|
For more details, run `redoc-cli --help`.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "redoc-cli",
|
"name": "redoc-cli",
|
||||||
"version": "0.12.1",
|
"version": "0.12.2",
|
||||||
"description": "ReDoc's Command Line Interface",
|
"description": "ReDoc's Command Line Interface",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": "index.js",
|
"bin": "index.js",
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
"node-libs-browser": "^2.2.1",
|
"node-libs-browser": "^2.2.1",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"redoc": "2.0.0-rc.54",
|
"redoc": "2.0.0-rc.55",
|
||||||
"styled-components": "^5.3.0",
|
"styled-components": "^5.3.0",
|
||||||
"yargs": "^17.0.1"
|
"yargs": "^17.0.1"
|
||||||
},
|
},
|
||||||
|
|
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -26,7 +26,7 @@
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"perfect-scrollbar": "^1.5.1",
|
"perfect-scrollbar": "^1.5.1",
|
||||||
"polished": "^4.1.3",
|
"polished": "^4.1.3",
|
||||||
"prismjs": "^1.24.0",
|
"prismjs": "^1.24.1",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react-tabs": "^3.2.2",
|
"react-tabs": "^3.2.2",
|
||||||
"slugify": "~1.4.7",
|
"slugify": "~1.4.7",
|
||||||
|
@ -15962,9 +15962,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prismjs": {
|
"node_modules/prismjs": {
|
||||||
"version": "1.24.0",
|
"version": "1.24.1",
|
||||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.0.tgz",
|
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz",
|
||||||
"integrity": "sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ=="
|
"integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow=="
|
||||||
},
|
},
|
||||||
"node_modules/process": {
|
"node_modules/process": {
|
||||||
"version": "0.11.10",
|
"version": "0.11.10",
|
||||||
|
@ -33230,9 +33230,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prismjs": {
|
"prismjs": {
|
||||||
"version": "1.24.0",
|
"version": "1.24.1",
|
||||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.0.tgz",
|
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz",
|
||||||
"integrity": "sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ=="
|
"integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow=="
|
||||||
},
|
},
|
||||||
"process": {
|
"process": {
|
||||||
"version": "0.11.10",
|
"version": "0.11.10",
|
||||||
|
|
|
@ -163,7 +163,7 @@
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"perfect-scrollbar": "^1.5.1",
|
"perfect-scrollbar": "^1.5.1",
|
||||||
"polished": "^4.1.3",
|
"polished": "^4.1.3",
|
||||||
"prismjs": "^1.24.0",
|
"prismjs": "^1.24.1",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"react-tabs": "^3.2.2",
|
"react-tabs": "^3.2.2",
|
||||||
"slugify": "~1.4.7",
|
"slugify": "~1.4.7",
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {
|
||||||
InfoSpanBox,
|
InfoSpanBox,
|
||||||
InfoSpanBoxWrap,
|
InfoSpanBoxWrap,
|
||||||
} from './styled.elements';
|
} from './styled.elements';
|
||||||
|
import { l } from '../../services/Labels';
|
||||||
|
|
||||||
export interface ApiInfoProps {
|
export interface ApiInfoProps {
|
||||||
store: AppStore;
|
store: AppStore;
|
||||||
|
@ -79,14 +80,14 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
|
||||||
</ApiHeader>
|
</ApiHeader>
|
||||||
{!hideDownloadButton && (
|
{!hideDownloadButton && (
|
||||||
<p>
|
<p>
|
||||||
Download OpenAPI specification:
|
{l('downloadSpecification')}:
|
||||||
<DownloadButton
|
<DownloadButton
|
||||||
download={downloadFilename || true}
|
download={downloadFilename || true}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={downloadLink}
|
href={downloadLink}
|
||||||
onClick={this.handleDownloadClick}
|
onClick={this.handleDownloadClick}
|
||||||
>
|
>
|
||||||
Download
|
{l('download')}
|
||||||
</DownloadButton>
|
</DownloadButton>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { SourceCodeWithCopy } from '../SourceCode/SourceCode';
|
||||||
|
|
||||||
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
||||||
import { OptionsContext } from '../OptionsProvider';
|
import { OptionsContext } from '../OptionsProvider';
|
||||||
|
import { l } from '../../services/Labels';
|
||||||
|
|
||||||
export interface RequestSamplesProps {
|
export interface RequestSamplesProps {
|
||||||
operation: OperationModel;
|
operation: OperationModel;
|
||||||
|
@ -26,7 +27,7 @@ export class RequestSamples extends React.Component<RequestSamplesProps> {
|
||||||
return (
|
return (
|
||||||
(hasSamples && (
|
(hasSamples && (
|
||||||
<div>
|
<div>
|
||||||
<RightPanelHeader> Request samples </RightPanelHeader>
|
<RightPanelHeader> {l('requestSamples')} </RightPanelHeader>
|
||||||
|
|
||||||
<Tabs defaultIndex={0}>
|
<Tabs defaultIndex={0}>
|
||||||
<TabList hidden={hideTabList}>
|
<TabList hidden={hideTabList}>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { OperationModel } from '../../services/models';
|
||||||
|
|
||||||
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
||||||
import { PayloadSamples } from '../PayloadSamples/PayloadSamples';
|
import { PayloadSamples } from '../PayloadSamples/PayloadSamples';
|
||||||
|
import { l } from '../../services/Labels';
|
||||||
|
|
||||||
export interface ResponseSamplesProps {
|
export interface ResponseSamplesProps {
|
||||||
operation: OperationModel;
|
operation: OperationModel;
|
||||||
|
@ -23,7 +24,7 @@ export class ResponseSamples extends React.Component<ResponseSamplesProps> {
|
||||||
return (
|
return (
|
||||||
(responses.length > 0 && (
|
(responses.length > 0 && (
|
||||||
<div>
|
<div>
|
||||||
<RightPanelHeader> Response samples </RightPanelHeader>
|
<RightPanelHeader> {l('responseSamples')} </RightPanelHeader>
|
||||||
|
|
||||||
<Tabs defaultIndex={0}>
|
<Tabs defaultIndex={0}>
|
||||||
<TabList>
|
<TabList>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { l } from '../../services/Labels';
|
||||||
import { ResponseModel } from '../../services/models';
|
import { ResponseModel } from '../../services/models';
|
||||||
import styled from '../../styled-components';
|
import styled from '../../styled-components';
|
||||||
import { ResponseView } from './Response';
|
import { ResponseView } from './Response';
|
||||||
|
@ -26,7 +27,7 @@ export class ResponsesList extends React.PureComponent<ResponseListProps> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<ResponsesHeader>{isCallback ? 'Callback responses' : 'Responses'}</ResponsesHeader>
|
<ResponsesHeader>{isCallback ? l('callbackResponses') : l('responses')}</ResponsesHeader>
|
||||||
{responses.map(response => {
|
{responses.map(response => {
|
||||||
return <ResponseView key={response.code} response={response} />;
|
return <ResponseView key={response.code} response={response} />;
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -10,6 +10,12 @@ export interface LabelsConfig {
|
||||||
arrayOf: string;
|
arrayOf: string;
|
||||||
webhook: string;
|
webhook: string;
|
||||||
const: string;
|
const: string;
|
||||||
|
download: string;
|
||||||
|
downloadSpecification: string;
|
||||||
|
responses: string;
|
||||||
|
callbackResponses: string;
|
||||||
|
requestSamples: string;
|
||||||
|
responseSamples: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LabelsConfigRaw = Partial<LabelsConfig>;
|
export type LabelsConfigRaw = Partial<LabelsConfig>;
|
||||||
|
@ -26,6 +32,12 @@ const labels: LabelsConfig = {
|
||||||
arrayOf: 'Array of ',
|
arrayOf: 'Array of ',
|
||||||
webhook: 'Event',
|
webhook: 'Event',
|
||||||
const: 'Value',
|
const: 'Value',
|
||||||
|
download: 'Download',
|
||||||
|
downloadSpecification: 'Download OpenAPI specification',
|
||||||
|
responses: 'Responses',
|
||||||
|
callbackResponses: 'Callback responses',
|
||||||
|
requestSamples: 'Request samples',
|
||||||
|
responseSamples: 'Response samples',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setRedocLabels(_labels?: LabelsConfigRaw) {
|
export function setRedocLabels(_labels?: LabelsConfigRaw) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import 'prismjs/components/prism-ruby.js';
|
||||||
import 'prismjs/components/prism-scala.js';
|
import 'prismjs/components/prism-scala.js';
|
||||||
import 'prismjs/components/prism-sql.js';
|
import 'prismjs/components/prism-sql.js';
|
||||||
import 'prismjs/components/prism-swift.js';
|
import 'prismjs/components/prism-swift.js';
|
||||||
|
import 'prismjs/components/prism-yaml.js';
|
||||||
|
|
||||||
const DEFAULT_LANG = 'clike';
|
const DEFAULT_LANG = 'clike';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user