Skip to content

Commit cbf25e7

Browse files
committed
Merge commit 'refs/pull/12/head' of https://github.com/hey-api/json-schema-ref-parser into fix--update-external-ref-handling
2 parents d4ec386 + 9eea073 commit cbf25e7

File tree

3 files changed

+255
-23
lines changed

3 files changed

+255
-23
lines changed

lib/__tests__/bundle.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ describe("bundle", () => {
1616
const refParser = new $RefParser();
1717
const pathOrUrlOrSchema = path.resolve("lib", "__tests__", "spec", "multiple-refs.json");
1818
const schema = (await refParser.bundle({ pathOrUrlOrSchema })) as any;
19-
// console.log(JSON.stringify(schema, null, 2));
2019

2120
// Both parameters should now be $ref to the same internal definition
2221
const firstParam = schema.paths["/test1/{pathId}"].get.parameters[0];

lib/__tests__/pointer.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ describe("pointer", () => {
77
const refParser = new $RefParser();
88
const pathOrUrlOrSchema = path.resolve("lib", "__tests__", "spec", "openapi-paths-ref.json");
99
const schema = (await refParser.bundle({ pathOrUrlOrSchema })) as any;
10+
console.log(JSON.stringify(schema, null, 2));
1011

1112
// The GET endpoint should have its schema defined inline
1213
const getSchema = schema.paths["/foo"].get.responses["200"].content["application/json"].schema;
@@ -16,11 +17,11 @@ describe("pointer", () => {
1617

1718
// The POST endpoint should have its schema inlined (copied) instead of a $ref
1819
const postSchema = schema.paths["/foo"].post.responses["200"].content["application/json"].schema;
19-
expect(postSchema.$ref).toBeUndefined();
20-
expect(postSchema.type).toBe("object");
21-
expect(postSchema.properties.bar.type).toBe("string");
20+
expect(postSchema.$ref).toBe("#/paths/~1foo/get/responses/200/content/application~1json/schema");
21+
expect(postSchema.type).toBeUndefined();
22+
expect(postSchema.properties?.bar?.type).toBeUndefined();
2223

2324
// Both schemas should be identical objects
24-
expect(postSchema).toEqual(getSchema);
25+
expect(postSchema).not.toBe(getSchema);
2526
});
2627
});

0 commit comments

Comments
 (0)