forked from APIDevTools/json-schema-ref-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdereference-preservedProperties.spec.ts
41 lines (38 loc) · 1.1 KB
/
dereference-preservedProperties.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { describe, it } from "vitest";
import $RefParser from "../../../lib/index.js";
import pathUtils from "../../utils/path.js";
import { expect } from "vitest";
import type { Options } from "../../../lib/options";
describe("dereference.preservedProperties", () => {
it("should preserve properties", async () => {
const parser = new $RefParser();
const schema = pathUtils.rel("test/specs/dereference-preservedProperties/dereference-preservedProperties.yaml");
const options = {
dereference: {
preservedProperties: ["description"],
},
} as Options;
const res = await parser.dereference(schema, options);
expect(res).to.deep.equal({
title: "Person",
required: ["name"],
type: "object",
definitions: {
name: {
type: "string",
description: "Someone's name",
},
},
properties: {
name: {
type: "string",
description: "Someone's name",
},
secretName: {
type: "string",
description: "Someone's secret name",
},
},
});
});
});