Skip to content
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

feat: support JSON Schema as input for a Type #1159

Open
wants to merge 95 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
2c2bdf1
improve wording of type example
ssalbdivad Jun 5, 2024
a3fd9cd
Merge branch 'main' into v2docs-6
ssalbdivad Jun 6, 2024
01583b0
runtime error messages increase font size
ssalbdivad Jun 6, 2024
9e3e772
rename RegexNode=>PatternNode
ssalbdivad Jun 6, 2024
85e5558
add changeset
ssalbdivad Jun 6, 2024
886e643
bump deps
ssalbdivad Jun 7, 2024
00baf27
fix morph with alias child
ssalbdivad Jun 7, 2024
2a94bcd
add changelogs
ssalbdivad Jun 7, 2024
98533ad
cyclic scope
ssalbdivad Jun 7, 2024
ae9342e
allow overriding aliases
ssalbdivad Jun 7, 2024
a2ed10f
add constraints to validation scope
ssalbdivad Jun 7, 2024
170bc6e
remove constraints type parameter constraints
ssalbdivad Jun 8, 2024
9d0bf28
remove broken cyclic rereferences test
ssalbdivad Jun 8, 2024
8628a77
cleanup anonymous constraint display
ssalbdivad Jun 8, 2024
77562e3
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Jun 12, 2024
b7c38a0
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Jun 14, 2024
0e5b2da
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Jun 24, 2024
cf77faa
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Jun 25, 2024
4c4e61f
Export from ark/schema/shared/traversal.ts so can import TraversalCon…
TizzySaurus Sep 23, 2024
934cd36
Add parsing & types for array JSON Schema (w/ excessively deep type e…
TizzySaurus Sep 23, 2024
d3bc90d
Add parsing & types for number/integer JSON Schema
TizzySaurus Sep 23, 2024
da95a37
Add parsing & types for string JSON Schema
TizzySaurus Sep 23, 2024
4d230c1
Add ArkType Scope representing JSON Schema schemas
TizzySaurus Sep 23, 2024
48a654a
Initialise ark/jsonschema package
TizzySaurus Sep 23, 2024
b343bfe
Add parsing & types for object JSON Schema
TizzySaurus Sep 23, 2024
98e9c03
Add parsing for allOf + anyOf + not + oneOf JSON Schemas
TizzySaurus Sep 23, 2024
6dbdbcd
Add parsing for const + enum JSON Schemas
TizzySaurus Sep 23, 2024
7248b27
Add core parseJsonSchema with parsing and type inference logic
TizzySaurus Sep 23, 2024
79c0a79
Add ark/jsonschema/index.ts entry level to @ark/jsonschema
TizzySaurus Sep 23, 2024
28da503
Add @ark/jsonschema to root package.json devDepencies
TizzySaurus Sep 23, 2024
4127422
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Sep 23, 2024
474a849
Export type Out from ark/type/keywords/inference.ts
TizzySaurus Sep 23, 2024
95e1b40
Fix @ark/jsonschema use of arktype constraint inference
TizzySaurus Sep 23, 2024
2e21553
Preliminary tests for @ark/jsonschema
TizzySaurus Oct 2, 2024
2d945b3
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Oct 2, 2024
94cdef2
Merge branch 'json-schema-to-arktype' of personal.github.com:TizzySau…
TizzySaurus Oct 2, 2024
6903094
Add ts-ignore comment for excessively deep tuple spread
TizzySaurus Oct 2, 2024
d65fa30
Add preliminary README.md for @ark/jsonschema
TizzySaurus Oct 2, 2024
8e97d87
Linting
TizzySaurus Oct 2, 2024
877f36e
Fix example in README.md
TizzySaurus Oct 2, 2024
d59336c
Remove extra double-slash in comment
TizzySaurus Oct 2, 2024
e150832
Remove old TODO
TizzySaurus Oct 2, 2024
f625bc9
Remove old comment
TizzySaurus Oct 2, 2024
dd130e8
Migrate .js imports to .ts imports
TizzySaurus Oct 5, 2024
4598d02
Remove accidentally added ark/jsonschema/del.ts file
TizzySaurus Oct 5, 2024
f7bd853
Remove changeset
TizzySaurus Oct 13, 2024
03ba515
Use type.enumerated and type.unit utils for 'const' and 'enum' JSON S…
TizzySaurus Oct 13, 2024
01e296c
Specify return type of function rather than double casting the return…
TizzySaurus Oct 13, 2024
dc43e17
Make variable assignment clearer & remove debug log statement
TizzySaurus Oct 13, 2024
be4fff2
Merge branch 'json-schema-to-arktype' of github.com:TizzySaurus/arkty…
TizzySaurus Oct 13, 2024
b6e5c70
Update @ark/jsonschema 'scripts' and 'exports' to match new style in …
TizzySaurus Oct 13, 2024
423ba89
Formatting
TizzySaurus Oct 13, 2024
2fe1b7a
Use conflatenateAll util instead of manually filtering out undefined …
TizzySaurus Oct 13, 2024
d0e612b
Remove accidentally added debugging file
TizzySaurus Oct 13, 2024
07a5215
Remove type inference from @ark/jsonschema
TizzySaurus Oct 25, 2024
2da7bb5
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Oct 25, 2024
a1f2911
Fix string tests
TizzySaurus Oct 25, 2024
0e1dac7
Remove redundant duplicate tests
TizzySaurus Oct 25, 2024
fc67ff7
Fix broken types
TizzySaurus Oct 25, 2024
aa81782
Use 'expected' and 'actual' props in ctx.reject and use 'Type' over '…
TizzySaurus Oct 26, 2024
de4c7cc
Use ctx.hasError instead of manually tracking ctx errors
TizzySaurus Oct 26, 2024
ce9b213
Fix incorrect exports from ark/type/index.ts
TizzySaurus Oct 29, 2024
ad9e053
Fix 'Expored variable innerParseJsonSchema has or is using name XXX f…
TizzySaurus Oct 29, 2024
8dc5826
Fix types for innerParseJsonSchema
TizzySaurus Oct 29, 2024
c55e9aa
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Oct 29, 2024
624c0ac
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Nov 17, 2024
9826c00
add getDuplicatesOf array util to @ark/util, bumping the package vers…
TizzySaurus Nov 17, 2024
5272e44
Update JSON Schema object parsing logic to use new getDuplicatesOf ut…
TizzySaurus Nov 17, 2024
aaf7d46
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Dec 3, 2024
6221890
Bump @ark/util version from 0.25.0 to 0.26.0 due to new getDuplicates…
TizzySaurus Dec 3, 2024
20f446b
Add support for JSON Schema 'prefixItems' keyword on arrays
TizzySaurus Dec 3, 2024
0fac361
Add unit tests for new 'prefixItems' support
TizzySaurus Dec 3, 2024
65112a1
Make JSON Schema types shared between arktype and @ark/jsonschema
TizzySaurus Dec 3, 2024
1567862
patch-fix broken 'arktype' and '@ark/util' unit tests
TizzySaurus Dec 3, 2024
d6c621e
Fix bugs in array JSON Schema parsing
TizzySaurus Feb 5, 2025
8efd3f1
Apply workaround to arktype jit compilation bug in JSON Schema
TizzySaurus Feb 5, 2025
ffddafb
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Feb 5, 2025
ba6c17d
Remove redundant cast and .describe from 'validateOneOfJsonSchemas'
TizzySaurus Feb 5, 2025
8e970c0
Update @ark/jsonschema to reflect renaming of 'TraversalContext' to '…
TizzySaurus Feb 5, 2025
c7c0b91
Remove incorrect & unused import
TizzySaurus Feb 5, 2025
eb93389
Bump @ark/util from 0.39.0 to 0.40.0 after merge with main to reflect…
TizzySaurus Feb 5, 2025
1a7a582
Fix type errors
TizzySaurus Feb 5, 2025
35796b9
Use ArkType's regex index signatures for patternProperties instead of…
TizzySaurus Feb 5, 2025
d9b60d2
Use ArkType's reject schema option for boolean additionalProperties i…
TizzySaurus Feb 6, 2025
5be9c21
Merge predicate and non-predicate schemas into one type, instead of t…
TizzySaurus Feb 6, 2025
ce852b3
Fix 'parsePropertyNames' and 'parseAdditionalProperties' returning fa…
TizzySaurus Feb 6, 2025
418f52e
Fix broken @ark/jsonschema unit tests
TizzySaurus Feb 6, 2025
259ed09
Fix broken arktype unit test
TizzySaurus Feb 6, 2025
b519607
Fix incorrect @arktype/jsonschema mentions in README to be @ark/jsons…
TizzySaurus Feb 15, 2025
dcd0813
Name predicates for json schema array 'uniqueItems' and 'contains' va…
TizzySaurus Feb 15, 2025
59f2698
Remove debug log statement
TizzySaurus Feb 15, 2025
c705812
Use type.never and type.unknown over type('never')/type('unknown') fo…
TizzySaurus Feb 15, 2025
de53201
Revert @ark/util version bump, as per PR comment
TizzySaurus Feb 15, 2025
3aa114e
Merge branch 'main' into json-schema-to-arktype
TizzySaurus Feb 15, 2025
a4defa8
Rename validateXXX functions to parseXXX, and make function names mor…
TizzySaurus Feb 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix example in README.md
TizzySaurus committed Oct 2, 2024
commit 877f36ea3d080f217f8a0c17cb717b6812f93850
6 changes: 3 additions & 3 deletions ark/jsonschema/README.md
Original file line number Diff line number Diff line change
@@ -22,11 +22,11 @@ const assertIsString = (data: unknown)
```

## Extra Type Safety
If you wish to ensure that your JSON Schema schemas are valid, you can do this too! Simply import the relevant schema type from `@ark/jsonschema`, like below:
If you wish to ensure that your JSON Schema schemas are valid, you can do this too! Simply import the `JsonSchema` namespace type from `@ark/jsonschema`, and use the appropriate member like so:
```ts
import type { JsonSchemaString } from "@ark/jsonschema"
import type { JsonSchema } from "@ark/jsonschema"

const schema: JsonSchemaString = {
const schema: JsonSchema.StringSchema = {
type: "string",
minLength: "3" // errors stating that 'minLength' must be a number
}