fix: actualize naming

This commit is contained in:
Andriy Zaleskyy 2021-08-31 10:23:55 +03:00
parent 5fa68a1c9d
commit 02c57403db
4 changed files with 11 additions and 11 deletions

View File

@ -14,7 +14,7 @@ describe('Models', () => {
defaultAsError: false,
infoOrRef: {},
options: opts,
reverseEventsReadWriteProps: false,
isEvent: false,
code: 'default',
};
});

View File

@ -76,7 +76,7 @@ export class OperationModel implements IMenuItem {
extensions: Record<string, any>;
isCallback: boolean;
isWebhook: boolean;
reverseEventsReadWriteProps: boolean;
isEvent: boolean;
constructor(
private parser: OpenAPIParser,
@ -100,7 +100,7 @@ export class OperationModel implements IMenuItem {
this.path = operationSpec.pathName;
this.isCallback = isCallback;
this.isWebhook = operationSpec.isWebhook;
this.reverseEventsReadWriteProps = this.isCallback || this.isWebhook;
this.isEvent = this.isCallback || this.isWebhook;
this.name = getOperationSummary(operationSpec);
@ -177,7 +177,7 @@ export class OperationModel implements IMenuItem {
parser: this.parser,
infoOrRef: this.operationSpec.requestBody,
options: this.options,
reverseEventsReadWriteProps: this.reverseEventsReadWriteProps,
isEvent: this.isEvent,
})
);
}
@ -252,7 +252,7 @@ export class OperationModel implements IMenuItem {
defaultAsError: hasSuccessResponses,
infoOrRef: this.operationSpec.responses[code],
options: this.options,
reverseEventsReadWriteProps: this.reverseEventsReadWriteProps,
isEvent: this.isEvent,
});
});
}

View File

@ -8,7 +8,7 @@ type RequestBodyProps = {
parser: OpenAPIParser;
infoOrRef: Referenced<OpenAPIRequestBody>;
options: RedocNormalizedOptions;
reverseEventsReadWriteProps: boolean;
isEvent: boolean;
}
export class RequestBodyModel {
@ -17,8 +17,8 @@ export class RequestBodyModel {
content?: MediaContentModel;
constructor(props: RequestBodyProps) {
const { parser, infoOrRef, options, reverseEventsReadWriteProps } = props;
const isRequest = reverseEventsReadWriteProps ? false : true;
const { parser, infoOrRef, options, isEvent } = props;
const isRequest = isEvent ? false : true;
const info = parser.deref(infoOrRef);
this.description = info.description || '';
this.required = !!info.required;

View File

@ -14,7 +14,7 @@ type ResponseProps = {
defaultAsError: boolean,
infoOrRef: Referenced<OpenAPIResponse>,
options: RedocNormalizedOptions,
reverseEventsReadWriteProps: boolean,
isEvent: boolean,
}
export class ResponseModel {
@ -29,8 +29,8 @@ export class ResponseModel {
headers: FieldModel[] = [];
constructor(props: ResponseProps) {
const { parser, code, defaultAsError, infoOrRef, options, reverseEventsReadWriteProps } = props;
const isRequest = reverseEventsReadWriteProps ? true : false;
const { parser, code, defaultAsError, infoOrRef, options, isEvent } = props;
const isRequest = isEvent ? true : false;
makeObservable(this);
this.expanded = options.expandResponses === 'all' || options.expandResponses[code];