mirror of
https://github.com/Redocly/redoc.git
synced 2025-07-29 17:40:05 +03:00
Update 217 files
This commit is contained in:
parent
eff730bada
commit
fb55aa5456
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -19,12 +19,12 @@ npm-debug.log*
|
|||
|
||||
# Dependency directory
|
||||
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
|
||||
node_modules
|
||||
# node_modules
|
||||
|
||||
lib/
|
||||
stats.json
|
||||
cypress/
|
||||
bundles/
|
||||
# bundles/
|
||||
typings/*
|
||||
!typings/styled-patch.d.ts
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ export class SectionItem extends React.Component<ContentItemProps> {
|
|||
<>
|
||||
<Row>
|
||||
<MiddlePanel compact={false}>
|
||||
<Header>
|
||||
<Header className="sar-header">
|
||||
<ShareLink to={this.props.item.id} />
|
||||
{name}
|
||||
</Header>
|
||||
|
|
|
@ -65,7 +65,9 @@ export class Field extends React.Component<FieldProps> {
|
|||
|
||||
const paramName = withSubSchema ? (
|
||||
<ClickablePropertyNameCell
|
||||
className={deprecated ? 'deprecated' : ''}
|
||||
className={
|
||||
deprecated ? 'deprecated ClickablePropertyNameCell' : 'ClickablePropertyNameCell'
|
||||
}
|
||||
kind={kind}
|
||||
title={name}
|
||||
>
|
||||
|
@ -92,12 +94,12 @@ export class Field extends React.Component<FieldProps> {
|
|||
<>
|
||||
<tr className={isLast ? 'last ' + className : className}>
|
||||
{paramName}
|
||||
<PropertyDetailsCell>
|
||||
<FieldDetails {...this.props} />
|
||||
<PropertyDetailsCell className={'PropertyDetailsCell ' + field.name}>
|
||||
<FieldDetails {...this.props} className="FieldDetails" />
|
||||
</PropertyDetailsCell>
|
||||
</tr>
|
||||
{expanded && withSubSchema && (
|
||||
<tr key={field.name + 'inner'}>
|
||||
<tr key={field.name + 'inner'} className="sar-tr">
|
||||
<PropertyCellWithInner colSpan={2}>
|
||||
<InnerPropertiesWrap>
|
||||
<Schema
|
||||
|
|
|
@ -14,7 +14,10 @@ export class ConstraintsView extends React.PureComponent<ConstraintsViewProps> {
|
|||
<span>
|
||||
{' '}
|
||||
{this.props.constraints.map(constraint => (
|
||||
<ConstraintItem key={constraint}> {constraint} </ConstraintItem>
|
||||
<ConstraintItem key={constraint} className="sar-ConstraintItem">
|
||||
{' '}
|
||||
{constraint}{' '}
|
||||
</ConstraintItem>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
|
|
|
@ -16,7 +16,8 @@ function FieldDetailComponent({ value, label, raw }: FieldDetailProps) {
|
|||
|
||||
return (
|
||||
<div>
|
||||
<FieldLabel> {label} </FieldLabel> <ExampleValue>{stringifyValue}</ExampleValue>
|
||||
<FieldLabel> {label} </FieldLabel>{' '}
|
||||
<ExampleValue className="sar-ExampleValue">{stringifyValue}</ExampleValue>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,15 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
|
|||
const { enumSkipQuotes, hideSchemaTitles } = React.useContext(OptionsContext);
|
||||
|
||||
const { showExamples, field, renderDiscriminatorSwitch } = props;
|
||||
const { schema, description, deprecated, extensions, in: _in, const: _const } = field;
|
||||
const {
|
||||
schema,
|
||||
description,
|
||||
descriptionClass,
|
||||
deprecated,
|
||||
extensions,
|
||||
in: _in,
|
||||
const: _const,
|
||||
} = field;
|
||||
const isArrayType = schema.type === 'array';
|
||||
|
||||
const rawDefault = enumSkipQuotes || _in === 'header'; // having quotes around header field default values is confusing and inappropriate
|
||||
|
@ -57,10 +65,10 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
|
|||
: schema.default;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<div className="FieldDetailsDiv">
|
||||
<div className="FieldDetailsDiv__childDiv1">
|
||||
<TypePrefix>{schema.typePrefix}</TypePrefix>
|
||||
<TypeName>{schema.displayType}</TypeName>
|
||||
<TypeName className="sar-TypeName">{schema.displayType}</TypeName>
|
||||
{schema.displayFormat && (
|
||||
<TypeFormat>
|
||||
{' '}
|
||||
|
@ -96,21 +104,30 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
|
|||
<Badge type="warning"> {l('deprecated')} </Badge>
|
||||
</div>
|
||||
)}
|
||||
<div className="FieldDetailsDiv__childDiv2">
|
||||
<FieldDetail raw={rawDefault} label={l('default') + ':'} value={defaultValue} />
|
||||
</div>
|
||||
|
||||
<div className="FieldDetailsDiv__childDiv3">
|
||||
{!renderDiscriminatorSwitch && (
|
||||
<EnumValues isArrayType={isArrayType} values={schema.enum} />
|
||||
)}{' '}
|
||||
{renderedExamples}
|
||||
</div>
|
||||
<div className="FieldDetailsDiv__childDiv4">
|
||||
<Extensions extensions={{ ...extensions, ...schema.extensions }} />
|
||||
<div>
|
||||
</div>
|
||||
<div className={descriptionClass + ' FieldDetailsDiv__description'}>
|
||||
<Markdown compact={true} source={description} />
|
||||
</div>
|
||||
<div className="FieldDetailsDiv__childDiv6">
|
||||
{schema.externalDocs && (
|
||||
<ExternalDocumentation externalDocs={schema.externalDocs} compact={true} />
|
||||
)}
|
||||
{(renderDiscriminatorSwitch && renderDiscriminatorSwitch(props)) || null}
|
||||
{(_const && <FieldDetail label={l('const') + ':'} value={_const} />) || null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -10,7 +10,17 @@ export interface ResponseViewProps {
|
|||
}
|
||||
|
||||
export const ResponseView = observer(({ response }: ResponseViewProps): React.ReactElement => {
|
||||
const { extensions, headers, type, summary, description, code, expanded, content } = response;
|
||||
const {
|
||||
extensions,
|
||||
headers,
|
||||
type,
|
||||
summary,
|
||||
description,
|
||||
descriptionClass,
|
||||
code,
|
||||
expanded,
|
||||
content,
|
||||
} = response;
|
||||
|
||||
const mimes = React.useMemo<MediaTypeModel[]>(
|
||||
() =>
|
||||
|
@ -29,14 +39,17 @@ export const ResponseView = observer(({ response }: ResponseViewProps): React.Re
|
|||
|
||||
return (
|
||||
<div>
|
||||
<span className="StyledResponseTitle">
|
||||
<StyledResponseTitle
|
||||
onClick={() => response.toggle()}
|
||||
type={type}
|
||||
empty={empty}
|
||||
title={summary || ''}
|
||||
descriptionClass={descriptionClass}
|
||||
code={code}
|
||||
opened={expanded}
|
||||
/>
|
||||
</span>
|
||||
{expanded && !empty && (
|
||||
<ResponseDetailsWrap>
|
||||
<ResponseDetails response={response} />
|
||||
|
|
|
@ -14,10 +14,12 @@ import { ConstraintsView } from '../Fields/FieldContstraints';
|
|||
|
||||
export class ResponseDetails extends React.PureComponent<{ response: ResponseModel }> {
|
||||
render() {
|
||||
const { description, extensions, headers, content } = this.props.response;
|
||||
const { description, descriptionClass, extensions, headers, content } = this.props.response;
|
||||
return (
|
||||
<>
|
||||
<span className={descriptionClass + ' ResponseDetails__description'}>
|
||||
{description && <Markdown source={description} />}
|
||||
</span>
|
||||
<Extensions extensions={extensions} />
|
||||
<ResponseHeaders headers={headers} />
|
||||
<MediaTypesSwitch content={content} renderDropdown={this.renderDropdown}>
|
||||
|
|
|
@ -8,6 +8,7 @@ export interface ResponseTitleProps {
|
|||
code: string;
|
||||
title: string;
|
||||
type: string;
|
||||
descriptionClass?: string;
|
||||
empty?: boolean;
|
||||
opened?: boolean;
|
||||
className?: string;
|
||||
|
@ -19,6 +20,7 @@ function ResponseTitleComponent({
|
|||
type,
|
||||
empty,
|
||||
code,
|
||||
descriptionClass,
|
||||
opened,
|
||||
className,
|
||||
onClick,
|
||||
|
@ -39,7 +41,9 @@ function ResponseTitleComponent({
|
|||
/>
|
||||
)}
|
||||
<Code>{code} </Code>
|
||||
<div className={descriptionClass + ' ResponseTitleComponent__Markdown'}>
|
||||
<Markdown compact={true} inline={true} source={title} />
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ export class ResponsesList extends React.PureComponent<ResponseListProps> {
|
|||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="ResponsesList">
|
||||
<ResponsesHeader>{isCallback ? l('callbackResponses') : l('responses')}</ResponsesHeader>
|
||||
{responses.map(response => {
|
||||
return <ResponseView key={response.code} response={response} />;
|
||||
|
|
|
@ -22,21 +22,14 @@
|
|||
"type": {
|
||||
"type": "string",
|
||||
"description": "The type of response.",
|
||||
"enum": [
|
||||
"TestResponse.Complete"
|
||||
]
|
||||
"enum": ["TestResponse.Complete"]
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"FAILURE",
|
||||
"SUCCESS"
|
||||
]
|
||||
"enum": ["FAILURE", "SUCCESS"]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"status"
|
||||
]
|
||||
"required": ["status"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
"schemas": {
|
||||
"Pet": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"type"
|
||||
],
|
||||
"required": ["type"],
|
||||
"discriminator": {
|
||||
"propertyName": "type"
|
||||
},
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
"summary": "Get a cat details after update",
|
||||
"description": "Get a cat details after update",
|
||||
"operationId": "updatedCat",
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"tags": ["pet"],
|
||||
"requestBody": {
|
||||
"description": "Information about cat in the system",
|
||||
"content": {
|
||||
|
@ -41,9 +39,7 @@
|
|||
"summary": "Create new cat",
|
||||
"description": "Info about new cat",
|
||||
"operationId": "createdCat",
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"tags": ["pet"],
|
||||
"requestBody": {
|
||||
"description": "Information about cat in the system",
|
||||
"content": {
|
||||
|
|
|
@ -21,21 +21,14 @@
|
|||
"type": {
|
||||
"type": "string",
|
||||
"description": "The type of response.",
|
||||
"enum": [
|
||||
"TestResponse.Complete"
|
||||
]
|
||||
"enum": ["TestResponse.Complete"]
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"FAILURE",
|
||||
"SUCCESS"
|
||||
]
|
||||
"enum": ["FAILURE", "SUCCESS"]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"status"
|
||||
]
|
||||
"required": ["status"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,4 +54,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,7 @@
|
|||
"JsonApiResource": {
|
||||
"type": "object",
|
||||
"description": "A related resource.",
|
||||
"required": [
|
||||
"type"
|
||||
],
|
||||
"required": ["type"],
|
||||
"discriminator": {
|
||||
"propertyName": "type"
|
||||
},
|
||||
|
@ -43,9 +41,7 @@
|
|||
},
|
||||
"FooTopLevel": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"data"
|
||||
],
|
||||
"required": ["data"],
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/components/schemas/Foo"
|
||||
|
|
|
@ -58,8 +58,9 @@
|
|||
}
|
||||
},
|
||||
"WithArray": {
|
||||
"oneOf": [{
|
||||
"type" : "array",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
|
@ -70,9 +71,11 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ export class FieldModel {
|
|||
name: string;
|
||||
required: boolean;
|
||||
description: string;
|
||||
descriptionClass: string;
|
||||
example?: string;
|
||||
examples?: Record<string, ExampleModel> | any[];
|
||||
deprecated: boolean;
|
||||
|
@ -117,6 +118,8 @@ export class FieldModel {
|
|||
}
|
||||
|
||||
this.const = this.schema?.const || info?.const || '';
|
||||
|
||||
this.descriptionClass = info.descriptionClass || '';
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
@ -25,6 +25,7 @@ export class ResponseModel {
|
|||
code: string;
|
||||
summary: string;
|
||||
description: string;
|
||||
descriptionClass?: string;
|
||||
type: string;
|
||||
headers: FieldModel[] = [];
|
||||
extensions: Record<string, any>;
|
||||
|
@ -68,6 +69,8 @@ export class ResponseModel {
|
|||
if (options.showExtensions) {
|
||||
this.extensions = extractExtensions(info, options.showExtensions);
|
||||
}
|
||||
|
||||
this.descriptionClass = info.descriptionClass || '';
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
@ -91,6 +91,7 @@ export interface OpenAPIParameter {
|
|||
name: string;
|
||||
in?: OpenAPIParameterLocation;
|
||||
description?: string;
|
||||
descriptionClass?: string;
|
||||
required?: boolean;
|
||||
deprecated?: boolean;
|
||||
allowEmptyValue?: boolean;
|
||||
|
@ -196,6 +197,7 @@ export type OpenAPIParameterStyle =
|
|||
|
||||
export interface OpenAPIRequestBody {
|
||||
description?: string;
|
||||
descriptionClass?: string;
|
||||
required?: boolean;
|
||||
content: { [mime: string]: OpenAPIMediaType };
|
||||
|
||||
|
@ -208,7 +210,10 @@ export interface OpenAPIResponses {
|
|||
}
|
||||
|
||||
export interface OpenAPIResponse
|
||||
extends Pick<OpenAPIRequestBody, 'description' | 'x-examples' | 'x-example'> {
|
||||
extends Pick<
|
||||
OpenAPIRequestBody,
|
||||
'description' | 'descriptionClass' | 'x-examples' | 'x-example'
|
||||
> {
|
||||
headers?: { [name: string]: Referenced<OpenAPIHeader> };
|
||||
links?: { [name: string]: Referenced<OpenAPILink> };
|
||||
content?: { [mime: string]: OpenAPIMediaType };
|
||||
|
|
Loading…
Reference in New Issue
Block a user