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**
|
||||
|
||||
## 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
|
||||
|
||||
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 bundle [spec]` - bundles spec and ReDoc into **zero-dependency** HTML file.
|
||||
- `redoc-cli serve [spec]` - starts the server with `spec` rendered with ReDoc.
|
||||
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:
|
||||
|
||||
- Bundle with main color changed to `orange`: <br> `$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange`
|
||||
- Serve with `nativeScrollbars` option set to true: <br> `$ redoc-cli serve [spec] --options.nativeScrollbars`
|
||||
- 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`
|
||||
- Bundle using custom template and add custom `templateOptions`: <br> `$ redoc-cli bundle [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"`
|
||||
- Bundle with the main color changed to `orange`:<br/>
|
||||
`$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange`
|
||||
- Serve with the `nativeScrollbars` option set to true:<br/>
|
||||
`$ 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",
|
||||
"version": "0.12.1",
|
||||
"version": "0.12.2",
|
||||
"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.54",
|
||||
"redoc": "2.0.0-rc.55",
|
||||
"styled-components": "^5.3.0",
|
||||
"yargs": "^17.0.1"
|
||||
},
|
||||
|
|
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -26,7 +26,7 @@
|
|||
"path-browserify": "^1.0.1",
|
||||
"perfect-scrollbar": "^1.5.1",
|
||||
"polished": "^4.1.3",
|
||||
"prismjs": "^1.24.0",
|
||||
"prismjs": "^1.24.1",
|
||||
"prop-types": "^15.7.2",
|
||||
"react-tabs": "^3.2.2",
|
||||
"slugify": "~1.4.7",
|
||||
|
@ -15962,9 +15962,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/prismjs": {
|
||||
"version": "1.24.0",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.0.tgz",
|
||||
"integrity": "sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ=="
|
||||
"version": "1.24.1",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz",
|
||||
"integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow=="
|
||||
},
|
||||
"node_modules/process": {
|
||||
"version": "0.11.10",
|
||||
|
@ -33230,9 +33230,9 @@
|
|||
}
|
||||
},
|
||||
"prismjs": {
|
||||
"version": "1.24.0",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.0.tgz",
|
||||
"integrity": "sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ=="
|
||||
"version": "1.24.1",
|
||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz",
|
||||
"integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow=="
|
||||
},
|
||||
"process": {
|
||||
"version": "0.11.10",
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
"path-browserify": "^1.0.1",
|
||||
"perfect-scrollbar": "^1.5.1",
|
||||
"polished": "^4.1.3",
|
||||
"prismjs": "^1.24.0",
|
||||
"prismjs": "^1.24.1",
|
||||
"prop-types": "^15.7.2",
|
||||
"react-tabs": "^3.2.2",
|
||||
"slugify": "~1.4.7",
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
InfoSpanBox,
|
||||
InfoSpanBoxWrap,
|
||||
} from './styled.elements';
|
||||
import { l } from '../../services/Labels';
|
||||
|
||||
export interface ApiInfoProps {
|
||||
store: AppStore;
|
||||
|
@ -79,14 +80,14 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
|
|||
</ApiHeader>
|
||||
{!hideDownloadButton && (
|
||||
<p>
|
||||
Download OpenAPI specification:
|
||||
{l('downloadSpecification')}:
|
||||
<DownloadButton
|
||||
download={downloadFilename || true}
|
||||
target="_blank"
|
||||
href={downloadLink}
|
||||
onClick={this.handleDownloadClick}
|
||||
>
|
||||
Download
|
||||
{l('download')}
|
||||
</DownloadButton>
|
||||
</p>
|
||||
)}
|
||||
|
|
|
@ -6,6 +6,7 @@ import { SourceCodeWithCopy } from '../SourceCode/SourceCode';
|
|||
|
||||
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
||||
import { OptionsContext } from '../OptionsProvider';
|
||||
import { l } from '../../services/Labels';
|
||||
|
||||
export interface RequestSamplesProps {
|
||||
operation: OperationModel;
|
||||
|
@ -26,7 +27,7 @@ export class RequestSamples extends React.Component<RequestSamplesProps> {
|
|||
return (
|
||||
(hasSamples && (
|
||||
<div>
|
||||
<RightPanelHeader> Request samples </RightPanelHeader>
|
||||
<RightPanelHeader> {l('requestSamples')} </RightPanelHeader>
|
||||
|
||||
<Tabs defaultIndex={0}>
|
||||
<TabList hidden={hideTabList}>
|
||||
|
|
|
@ -5,6 +5,7 @@ import { OperationModel } from '../../services/models';
|
|||
|
||||
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
||||
import { PayloadSamples } from '../PayloadSamples/PayloadSamples';
|
||||
import { l } from '../../services/Labels';
|
||||
|
||||
export interface ResponseSamplesProps {
|
||||
operation: OperationModel;
|
||||
|
@ -23,7 +24,7 @@ export class ResponseSamples extends React.Component<ResponseSamplesProps> {
|
|||
return (
|
||||
(responses.length > 0 && (
|
||||
<div>
|
||||
<RightPanelHeader> Response samples </RightPanelHeader>
|
||||
<RightPanelHeader> {l('responseSamples')} </RightPanelHeader>
|
||||
|
||||
<Tabs defaultIndex={0}>
|
||||
<TabList>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as React from 'react';
|
||||
import { l } from '../../services/Labels';
|
||||
import { ResponseModel } from '../../services/models';
|
||||
import styled from '../../styled-components';
|
||||
import { ResponseView } from './Response';
|
||||
|
@ -26,7 +27,7 @@ export class ResponsesList extends React.PureComponent<ResponseListProps> {
|
|||
|
||||
return (
|
||||
<div>
|
||||
<ResponsesHeader>{isCallback ? 'Callback responses' : 'Responses'}</ResponsesHeader>
|
||||
<ResponsesHeader>{isCallback ? l('callbackResponses') : l('responses')}</ResponsesHeader>
|
||||
{responses.map(response => {
|
||||
return <ResponseView key={response.code} response={response} />;
|
||||
})}
|
||||
|
|
|
@ -10,6 +10,12 @@ export interface LabelsConfig {
|
|||
arrayOf: string;
|
||||
webhook: string;
|
||||
const: string;
|
||||
download: string;
|
||||
downloadSpecification: string;
|
||||
responses: string;
|
||||
callbackResponses: string;
|
||||
requestSamples: string;
|
||||
responseSamples: string;
|
||||
}
|
||||
|
||||
export type LabelsConfigRaw = Partial<LabelsConfig>;
|
||||
|
@ -26,6 +32,12 @@ const labels: LabelsConfig = {
|
|||
arrayOf: 'Array of ',
|
||||
webhook: 'Event',
|
||||
const: 'Value',
|
||||
download: 'Download',
|
||||
downloadSpecification: 'Download OpenAPI specification',
|
||||
responses: 'Responses',
|
||||
callbackResponses: 'Callback responses',
|
||||
requestSamples: 'Request samples',
|
||||
responseSamples: 'Response samples',
|
||||
};
|
||||
|
||||
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-sql.js';
|
||||
import 'prismjs/components/prism-swift.js';
|
||||
import 'prismjs/components/prism-yaml.js';
|
||||
|
||||
const DEFAULT_LANG = 'clike';
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user