forked from APIDevTools/json-schema-ref-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: force yaml loading to confirm to json-compatible types
- Loading branch information
Showing
4 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use strict"; | ||
|
||
const { expect } = require("chai"); | ||
const $RefParser = require("../../.."); | ||
const helper = require("../../utils/helper"); | ||
const path = require("../../utils/path"); | ||
const parsedSchema = require("./parsed"); | ||
|
||
describe("Schema with date strings", () => { | ||
it("should parse successfully", async () => { | ||
let parser = new $RefParser(); | ||
const schema = await parser.parse(path.rel("specs/date-strings/date-strings.yaml")); | ||
expect(schema).to.equal(parser.schema); | ||
expect(schema).to.deep.equal(parsedSchema.schema); | ||
expect(parser.$refs.paths()).to.deep.equal([path.abs("specs/date-strings/date-strings.yaml")]); | ||
}); | ||
|
||
it("should resolve successfully", helper.testResolve( | ||
path.rel("specs/date-strings/date-strings.yaml"), | ||
path.abs("specs/date-strings/date-strings.yaml"), parsedSchema.schema, | ||
)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
title: Date Strings | ||
type: object | ||
properties: | ||
name: | ||
description: 2015-04-22T10:03:19.323-07:00 | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use strict"; | ||
|
||
module.exports = { | ||
schema: { | ||
title: "Date Strings", | ||
type: "object", | ||
properties: { | ||
name: { | ||
description: "2015-04-22T10:03:19.323-07:00", | ||
type: "string" | ||
} | ||
} | ||
} | ||
}; |