Skip to content

Commit

Permalink
fix: server overriding didn't work on Path Item object
Browse files Browse the repository at this point in the history
fixes #656
  • Loading branch information
RomanHotsiy committed Sep 27, 2018
1 parent 10ab7da commit 355764d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/services/models/Operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { IMenuItem } from '../MenuStore';
import { GroupModel } from './Group.model';
import { SecurityRequirementModel } from './SecurityRequirement';

import { OpenAPIExternalDocumentation, OpenAPIServer, OpenAPIXCodeSample } from '../../types';
import {
OpenAPIExternalDocumentation,
OpenAPIPath,
OpenAPIServer,
OpenAPIXCodeSample,
} from '../../types';

import {
getOperationSummary,
Expand Down Expand Up @@ -83,9 +88,14 @@ export class OperationModel implements IMenuItem {
this.operationId = operationSpec.operationId;
this.codeSamples = operationSpec['x-code-samples'] || [];
this.path = operationSpec.pathName;

const pathInfo = parser.byRef<OpenAPIPath>(
JsonPointer.compile(['paths', operationSpec.pathName]),
);

this.servers = normalizeServers(
parser.specUrl,
operationSpec.servers || parser.spec.servers || [],
operationSpec.servers || (pathInfo && pathInfo.servers) || parser.spec.servers || [],
);

this.security = (operationSpec.security || parser.spec.security || []).map(
Expand Down

0 comments on commit 355764d

Please sign in to comment.