Skip to content

Commit

Permalink
fix: OpenAPI 3.1: Missing description when $ref used Redocly#1727
Browse files Browse the repository at this point in the history
  • Loading branch information
Marshevskyy committed Oct 11, 2021
1 parent 35f7787 commit fe6909e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
7 changes: 0 additions & 7 deletions src/services/OpenAPIParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,6 @@ export class OpenAPIParser {
}
}

shalowDeref<T extends object>(obj: OpenAPIRef | T): T {
if (this.isRef(obj)) {
return this.byRef<T>(obj.$ref)!;
}
return obj;
}

/**
* Merge allOf constraints.
* @param schema schema with allOF
Expand Down
2 changes: 1 addition & 1 deletion src/services/models/MediaType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class MediaTypeModel {
this.examples = {
default: new ExampleModel(
parser,
{ value: parser.shalowDeref(info.example) },
{ value: parser.shallowDeref(info.example) },
name,
info.encoding,
),
Expand Down
4 changes: 2 additions & 2 deletions src/utils/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,13 @@ export function mergeParams(
): Array<Referenced<OpenAPIParameter>> {
const operationParamNames = {};
operationParams.forEach(param => {
param = parser.shalowDeref(param);
param = parser.shallowDeref(param);
operationParamNames[param.name + '_' + param.in] = true;
});

// filter out path params overridden by operation ones with the same name
pathParams = pathParams.filter(param => {
param = parser.shalowDeref(param);
param = parser.shallowDeref(param);
return !operationParamNames[param.name + '_' + param.in];
});

Expand Down

0 comments on commit fe6909e

Please sign in to comment.