Skip to content

Commit 355764d

Browse files
committed
fix: server overriding didn't work on Path Item object
fixes #656
1 parent 10ab7da commit 355764d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/services/models/Operation.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { IMenuItem } from '../MenuStore';
44
import { GroupModel } from './Group.model';
55
import { SecurityRequirementModel } from './SecurityRequirement';
66

7-
import { OpenAPIExternalDocumentation, OpenAPIServer, OpenAPIXCodeSample } from '../../types';
7+
import {
8+
OpenAPIExternalDocumentation,
9+
OpenAPIPath,
10+
OpenAPIServer,
11+
OpenAPIXCodeSample,
12+
} from '../../types';
813

914
import {
1015
getOperationSummary,
@@ -83,9 +88,14 @@ export class OperationModel implements IMenuItem {
8388
this.operationId = operationSpec.operationId;
8489
this.codeSamples = operationSpec['x-code-samples'] || [];
8590
this.path = operationSpec.pathName;
91+
92+
const pathInfo = parser.byRef<OpenAPIPath>(
93+
JsonPointer.compile(['paths', operationSpec.pathName]),
94+
);
95+
8696
this.servers = normalizeServers(
8797
parser.specUrl,
88-
operationSpec.servers || parser.spec.servers || [],
98+
operationSpec.servers || (pathInfo && pathInfo.servers) || parser.spec.servers || [],
8999
);
90100

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

0 commit comments

Comments
 (0)