fix: server overriding didn't work on Path Item object

fixes #656
This commit is contained in:
Roman Hotsiy 2018-09-27 10:20:01 +03:00
parent 10ab7dabc0
commit 355764dcd4
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -4,7 +4,12 @@ import { IMenuItem } from '../MenuStore';
import { GroupModel } from './Group.model'; import { GroupModel } from './Group.model';
import { SecurityRequirementModel } from './SecurityRequirement'; import { SecurityRequirementModel } from './SecurityRequirement';
import { OpenAPIExternalDocumentation, OpenAPIServer, OpenAPIXCodeSample } from '../../types'; import {
OpenAPIExternalDocumentation,
OpenAPIPath,
OpenAPIServer,
OpenAPIXCodeSample,
} from '../../types';
import { import {
getOperationSummary, getOperationSummary,
@ -83,9 +88,14 @@ export class OperationModel implements IMenuItem {
this.operationId = operationSpec.operationId; this.operationId = operationSpec.operationId;
this.codeSamples = operationSpec['x-code-samples'] || []; this.codeSamples = operationSpec['x-code-samples'] || [];
this.path = operationSpec.pathName; this.path = operationSpec.pathName;
const pathInfo = parser.byRef<OpenAPIPath>(
JsonPointer.compile(['paths', operationSpec.pathName]),
);
this.servers = normalizeServers( this.servers = normalizeServers(
parser.specUrl, parser.specUrl,
operationSpec.servers || parser.spec.servers || [], operationSpec.servers || (pathInfo && pathInfo.servers) || parser.spec.servers || [],
); );
this.security = (operationSpec.security || parser.spec.security || []).map( this.security = (operationSpec.security || parser.spec.security || []).map(