-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renames fields-to-jsonschema file to indicate it only contains snapsh…
…ot tests. generates snapshots
- Loading branch information
Showing
2 changed files
with
113 additions
and
19 deletions.
There are no files selected for viewing
111 changes: 111 additions & 0 deletions
111
packages/core/src/__tests__/__snapshots__/fields-to-jsonschema.snapshot.test.ts.snap
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,111 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`conditionally required field schema generation should generate a schema when one field depends on another 1`] = ` | ||
Object { | ||
"$schema": "http://json-schema.org/schema#", | ||
"additionalProperties": false, | ||
"allOf": Array [ | ||
Object { | ||
"if": Object { | ||
"properties": Object { | ||
"a": Object { | ||
"const": "a_value", | ||
}, | ||
}, | ||
}, | ||
"then": Object { | ||
"required": Array [ | ||
"b", | ||
], | ||
}, | ||
}, | ||
], | ||
"properties": Object { | ||
"a": Object { | ||
"default": undefined, | ||
"description": "a", | ||
"format": undefined, | ||
"title": "a", | ||
"type": "string", | ||
}, | ||
"b": Object { | ||
"default": undefined, | ||
"description": "b", | ||
"format": undefined, | ||
"title": "b", | ||
"type": "string", | ||
}, | ||
}, | ||
"required": Array [ | ||
"a", | ||
], | ||
"type": "object", | ||
} | ||
`; | ||
|
||
exports[`conditionally required field schema generation should generate a schema when one field depends on multiple other fields 1`] = ` | ||
Object { | ||
"$schema": "http://json-schema.org/schema#", | ||
"additionalProperties": false, | ||
"allOf": Array [ | ||
Object { | ||
"if": Object { | ||
"allOf": Array [ | ||
Object { | ||
"properties": Object { | ||
"a": Object { | ||
"const": "a_value", | ||
}, | ||
}, | ||
"required": Array [ | ||
"a", | ||
], | ||
}, | ||
Object { | ||
"properties": Object { | ||
"b": Object { | ||
"const": "b_value", | ||
}, | ||
}, | ||
"required": Array [ | ||
"b", | ||
], | ||
}, | ||
], | ||
}, | ||
"then": Object { | ||
"required": Array [ | ||
"c", | ||
], | ||
}, | ||
}, | ||
], | ||
"properties": Object { | ||
"a": Object { | ||
"default": undefined, | ||
"description": "a", | ||
"format": undefined, | ||
"title": "a", | ||
"type": "string", | ||
}, | ||
"b": Object { | ||
"default": undefined, | ||
"description": "b", | ||
"format": undefined, | ||
"title": "b", | ||
"type": "string", | ||
}, | ||
"c": Object { | ||
"default": undefined, | ||
"description": "c", | ||
"format": undefined, | ||
"title": "c", | ||
"type": "string", | ||
}, | ||
}, | ||
"required": Array [ | ||
"a", | ||
], | ||
"type": "object", | ||
} | ||
`; |
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