-
-
Notifications
You must be signed in to change notification settings - Fork 26
added getAllSchema function #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import { test, expect, describe } from "vitest"; | ||
import { getAllSchemas } from "./experimental.js"; | ||
import { registerSchema } from "./schema.js"; | ||
import "../draft-2020-12/index.js"; | ||
import "../draft-2019-09/index.js"; | ||
import "../draft-04/index.js"; | ||
import "../draft-06/index.js"; | ||
import "../draft-07/index.js"; | ||
import "../openapi-3-0/index.js"; | ||
import "../openapi-3-1/index.js"; | ||
import "../stable/index.js"; | ||
Check failure on line 11 in lib/get-all-schemas.spec.ts
|
||
jdesrosiers marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
describe("getAllSchemas function", () => { | ||
test("should return all registered schema URIs", () => { | ||
const schemaUris = getAllSchemas(); | ||
expect(schemaUris).toEqual([ | ||
"https://json-schema.org/draft/2020-12/schema", | ||
"https://json-schema.org/draft/2020-12/meta/core", | ||
"https://json-schema.org/draft/2020-12/meta/applicator", | ||
"https://json-schema.org/draft/2020-12/meta/validation", | ||
"https://json-schema.org/draft/2020-12/meta/meta-data", | ||
"https://json-schema.org/draft/2020-12/meta/format-annotation", | ||
"https://json-schema.org/draft/2020-12/meta/format-assertion", | ||
"https://json-schema.org/draft/2020-12/meta/content", | ||
"https://json-schema.org/draft/2020-12/meta/unevaluated", | ||
"https://json-schema.org/draft/2019-09/schema", | ||
"https://json-schema.org/draft/2019-09/meta/core", | ||
"https://json-schema.org/draft/2019-09/meta/applicator", | ||
"https://json-schema.org/draft/2019-09/meta/validation", | ||
"https://json-schema.org/draft/2019-09/meta/meta-data", | ||
"https://json-schema.org/draft/2019-09/meta/format", | ||
"https://json-schema.org/draft/2019-09/meta/content", | ||
"http://json-schema.org/draft-04/schema", | ||
"http://json-schema.org/draft-06/schema", | ||
"http://json-schema.org/draft-07/schema", | ||
"https://spec.openapis.org/oas/3.0/dialect", | ||
"https://spec.openapis.org/oas/3.0/schema", | ||
"https://spec.openapis.org/oas/3.0/schema/latest", | ||
"https://spec.openapis.org/oas/3.1/meta/base", | ||
"https://spec.openapis.org/oas/3.1/dialect/base", | ||
"https://spec.openapis.org/oas/3.1/schema", | ||
"https://spec.openapis.org/oas/3.1/schema/latest", | ||
"https://spec.openapis.org/oas/3.1/schema-base", | ||
"https://spec.openapis.org/oas/3.1/schema-base/latest", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-2020-12", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-2019-09", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-07", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-06", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-04", | ||
"https://json-schema.org/validation", | ||
"https://json-schema.org/meta/core", | ||
"https://json-schema.org/meta/applicator", | ||
"https://json-schema.org/meta/validation", | ||
"https://json-schema.org/meta/meta-data", | ||
"https://json-schema.org/meta/format-annotation", | ||
"https://json-schema.org/meta/format-assertion", | ||
"https://json-schema.org/meta/content", | ||
"https://json-schema.org/meta/unevaluated", | ||
Check failure on line 58 in lib/get-all-schemas.spec.ts
|
||
]); | ||
}); | ||
|
||
test("should return all schemas along with custom registered schemas", () => { | ||
registerSchema({ | ||
"$id": "http://example.com/custom-schema", | ||
"$schema": "https://json-schema.org/draft/2020-12/schema" | ||
}); | ||
|
||
const schemaUris = getAllSchemas(); | ||
expect(schemaUris).toEqual([ | ||
"https://json-schema.org/draft/2020-12/schema", | ||
Check failure on line 70 in lib/get-all-schemas.spec.ts
|
||
"https://json-schema.org/draft/2020-12/meta/core", | ||
Check failure on line 71 in lib/get-all-schemas.spec.ts
|
||
"https://json-schema.org/draft/2020-12/meta/applicator", | ||
Check failure on line 72 in lib/get-all-schemas.spec.ts
|
||
"https://json-schema.org/draft/2020-12/meta/validation", | ||
Check failure on line 73 in lib/get-all-schemas.spec.ts
|
||
"https://json-schema.org/draft/2020-12/meta/meta-data", | ||
Check failure on line 74 in lib/get-all-schemas.spec.ts
|
||
"https://json-schema.org/draft/2020-12/meta/format-annotation", | ||
Check failure on line 75 in lib/get-all-schemas.spec.ts
|
||
"https://json-schema.org/draft/2020-12/meta/format-assertion", | ||
Check failure on line 76 in lib/get-all-schemas.spec.ts
|
||
"https://json-schema.org/draft/2020-12/meta/content", | ||
Check failure on line 77 in lib/get-all-schemas.spec.ts
|
||
"https://json-schema.org/draft/2020-12/meta/unevaluated", | ||
"https://json-schema.org/draft/2019-09/schema", | ||
"https://json-schema.org/draft/2019-09/meta/core", | ||
"https://json-schema.org/draft/2019-09/meta/applicator", | ||
"https://json-schema.org/draft/2019-09/meta/validation", | ||
"https://json-schema.org/draft/2019-09/meta/meta-data", | ||
"https://json-schema.org/draft/2019-09/meta/format", | ||
"https://json-schema.org/draft/2019-09/meta/content", | ||
"http://json-schema.org/draft-04/schema", | ||
"http://json-schema.org/draft-06/schema", | ||
"http://json-schema.org/draft-07/schema", | ||
"https://spec.openapis.org/oas/3.0/dialect", | ||
"https://spec.openapis.org/oas/3.0/schema", | ||
"https://spec.openapis.org/oas/3.0/schema/latest", | ||
"https://spec.openapis.org/oas/3.1/meta/base", | ||
"https://spec.openapis.org/oas/3.1/dialect/base", | ||
"https://spec.openapis.org/oas/3.1/schema", | ||
"https://spec.openapis.org/oas/3.1/schema/latest", | ||
"https://spec.openapis.org/oas/3.1/schema-base", | ||
"https://spec.openapis.org/oas/3.1/schema-base/latest", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-2020-12", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-2019-09", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-07", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-06", | ||
"https://spec.openapis.org/oas/3.1/schema-draft-04", | ||
"https://json-schema.org/validation", | ||
"https://json-schema.org/meta/core", | ||
"https://json-schema.org/meta/applicator", | ||
"https://json-schema.org/meta/validation", | ||
"https://json-schema.org/meta/meta-data", | ||
"https://json-schema.org/meta/format-annotation", | ||
"https://json-schema.org/meta/format-assertion", | ||
"https://json-schema.org/meta/content", | ||
"https://json-schema.org/meta/unevaluated", | ||
"http://example.com/custom-schema" | ||
]); | ||
}); | ||
}); |
Uh oh!
There was an error while loading. Please reload this page.