Skip to content

Commit

Permalink
define JsfSchema type extending JSONSchema
Browse files Browse the repository at this point in the history
  • Loading branch information
Luka Dornhecker committed Jan 27, 2025
1 parent 8064015 commit 7c63023
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"babel-jest": "^29.7.0",
"eslint": "^9.18.0",
"jest": "^29.7.0",
"json-schema-typed": "^8.0.1",
"tsup": "^8.3.5",
"typescript": "^5.7.3"
}
Expand Down
8 changes: 8 additions & 0 deletions next/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion next/src/form.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export function createHeadlessForm(): never {
import type { JsfSchema } from './types'

export function createHeadlessForm(_schema: JsfSchema): never {
throw new Error('Not implemented')
}
9 changes: 9 additions & 0 deletions next/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { JSONSchema } from 'json-schema-typed/draft-2020-12'

export type JsfSchema = Exclude<JSONSchema, boolean> & {
'x-jsf-logic'?: {
validations: Record<string, object>
computedValues: Record<string, object>
}
'x-jsf-order'?: string[]
}
1 change: 1 addition & 0 deletions next/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand Down

0 comments on commit 7c63023

Please sign in to comment.