mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-08 14:14:56 +03:00
Cleanup, fix tests
This commit is contained in:
parent
1f230e3e5b
commit
b001efa412
|
@ -1,13 +1,13 @@
|
|||
import { observer } from 'mobx-react';
|
||||
import * as React from 'react';
|
||||
import { isPayloadSample, RedocNormalizedOptions } from '../../services';
|
||||
import { PayloadSamples } from '../PayloadSamples/PayloadSamples';
|
||||
import { SourceCodeWithCopy } from '../SourceCode/SourceCode';
|
||||
|
||||
import { RightPanelHeader, Tab, TabList, TabPanel, Tabs } from '../../common-elements';
|
||||
import { OptionsContext } from '../OptionsProvider';
|
||||
import { isPayloadSample, RedocNormalizedOptions } from '../../services';
|
||||
import { CallbackModel } from '../../services/models';
|
||||
import { Endpoint } from '../Endpoint/Endpoint';
|
||||
import { OptionsContext } from '../OptionsProvider';
|
||||
import { PayloadSamples } from '../PayloadSamples/PayloadSamples';
|
||||
import { SourceCodeWithCopy } from '../SourceCode/SourceCode';
|
||||
|
||||
export interface CallbackSamplesProps {
|
||||
callbacks: CallbackModel[];
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { observer } from 'mobx-react';
|
||||
import * as React from 'react';
|
||||
|
||||
import { OperationModel } from '../../services/models';
|
||||
import { CallbackDetails } from './CallbackDetails';
|
||||
import { CallbackDetailsWrap, StyledCallbackTitle } from '../Callbacks/styled.elements';
|
||||
import { CallbackDetails } from './CallbackDetails';
|
||||
|
||||
@observer
|
||||
export class CallbackView extends React.Component<{ callbackOperation: OperationModel }> {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as React from 'react';
|
||||
|
||||
import { OperationModel } from '../../services/models';
|
||||
import { OperationItem } from '../ContentItems/ContentItems';
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as React from 'react';
|
||||
|
||||
import { CallbackModel } from '../../services/models';
|
||||
import styled from '../../styled-components';
|
||||
import { CallbackView } from './Callback';
|
||||
|
|
|
@ -1,26 +1,22 @@
|
|||
import * as React from 'react';
|
||||
import { SecurityRequirements } from '../SecurityRequirement/SecurityRequirement';
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import * as React from 'react';
|
||||
|
||||
import { Badge, DarkRightPanel, H2, MiddlePanel, Row } from '../../common-elements';
|
||||
|
||||
import { OptionsContext } from '../OptionsProvider';
|
||||
|
||||
import { ShareLink } from '../../common-elements/linkify';
|
||||
import { OperationModel as OperationType } from '../../services/models';
|
||||
import styled from '../../styled-components';
|
||||
import { CallbacksList } from '../Callbacks';
|
||||
import { CallbackSamples } from '../CallbackSamples/CallbackSamples';
|
||||
import { Endpoint } from '../Endpoint/Endpoint';
|
||||
import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocumentation';
|
||||
import { Extensions } from '../Fields/Extensions';
|
||||
import { Markdown } from '../Markdown/Markdown';
|
||||
import { OptionsContext } from '../OptionsProvider';
|
||||
import { Parameters } from '../Parameters/Parameters';
|
||||
import { RequestSamples } from '../RequestSamples/RequestSamples';
|
||||
import { ResponsesList } from '../Responses/ResponsesList';
|
||||
import { ResponseSamples } from '../ResponseSamples/ResponseSamples';
|
||||
import { CallbacksList } from '../Callbacks';
|
||||
import { CallbackSamples } from '../CallbackSamples/CallbackSamples';
|
||||
|
||||
import { OperationModel as OperationType } from '../../services/models';
|
||||
import styled from '../../styled-components';
|
||||
import { Extensions } from '../Fields/Extensions';
|
||||
import { SecurityRequirements } from '../SecurityRequirement/SecurityRequirement';
|
||||
|
||||
const CallbackMiddlePanel = styled(MiddlePanel)`
|
||||
width: 100%;
|
||||
|
|
|
@ -4,9 +4,8 @@ import { shallow } from 'enzyme';
|
|||
import * as React from 'react';
|
||||
|
||||
import { OpenAPIParser } from '../../services';
|
||||
import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
|
||||
|
||||
import { CallbackModel } from '../../services/models/Callback';
|
||||
import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
|
||||
import { CallbacksList, CallbackTitle, CallbackView } from '../Callbacks';
|
||||
import * as simpleCallbackFixture from './fixtures/simple-callback.json';
|
||||
|
||||
|
@ -21,6 +20,7 @@ describe('Components', () => {
|
|||
{ $ref: '#/components/callbacks/Test' },
|
||||
options,
|
||||
);
|
||||
// There should be 1 operation defined in simple-callback.json, just get it manually for readability.
|
||||
const callbackViewElement = shallow(
|
||||
<CallbackView key={callback.name} callbackOperation={callback.operations[0]} />,
|
||||
).getElement();
|
||||
|
|
|
@ -1,64 +1,66 @@
|
|||
{
|
||||
"openapi": "3.0.0",
|
||||
"info": {
|
||||
"version": "1.0",
|
||||
"title": "Foo"
|
||||
},
|
||||
"components": {
|
||||
"callbacks": {
|
||||
"Test": {
|
||||
"post": {
|
||||
"operationId": "testCallback",
|
||||
"description": "Test callback.",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"title": "TestTitle",
|
||||
"type": "object",
|
||||
"description": "Test description",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "The type of response.",
|
||||
"enum": [
|
||||
"TestResponse.Complete"
|
||||
]
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"FAILURE",
|
||||
"SUCCESS"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"status"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "X-Test-Header",
|
||||
"in": "header",
|
||||
"required": true,
|
||||
"example": "1",
|
||||
"description": "This is a test header parameter",
|
||||
"openapi": "3.0.0",
|
||||
"info": {
|
||||
"version": "1.0",
|
||||
"title": "Foo"
|
||||
},
|
||||
"components": {
|
||||
"callbacks": {
|
||||
"Test": {
|
||||
"/test": {
|
||||
"post": {
|
||||
"operationId": "testCallback",
|
||||
"description": "Test callback.",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "string"
|
||||
"title": "TestTitle",
|
||||
"type": "object",
|
||||
"description": "Test description",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "The type of response.",
|
||||
"enum": [
|
||||
"TestResponse.Complete"
|
||||
]
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"FAILURE",
|
||||
"SUCCESS"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"status"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "Test response."
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "X-Test-Header",
|
||||
"in": "header",
|
||||
"required": true,
|
||||
"example": "1",
|
||||
"description": "This is a test header parameter",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "Test response."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import { action, observable } from 'mobx';
|
||||
|
||||
import { OpenAPICallback, Referenced } from '../../types';
|
||||
import { isOperationName } from '../../utils';
|
||||
import { OpenAPIParser } from '../OpenAPIParser';
|
||||
|
|
Loading…
Reference in New Issue
Block a user