Skip to content

Commit

Permalink
feat(json-schema): support extend schema property (alibaba#2284)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang authored Oct 11, 2021
1 parent 85ab107 commit 67ca5e5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"ts-jest": "^26.0.0",
"ts-loader": "^7.0.4",
"ts-node": "^9.1.1",
"typescript": "4.1.5",
"typescript": "^4.3.0",
"vue-eslint-parser": "^7.1.1",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
Expand Down
3 changes: 3 additions & 0 deletions packages/json-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"build:umd": "rollup --config",
"build:global": "ts-node ../../scripts/build-global"
},
"peerDependencies": {
"typescript": "^4.4.0"
},
"dependencies": {
"@formily/core": "2.0.0-rc.14",
"@formily/reactive": "2.0.0-rc.14",
Expand Down
4 changes: 3 additions & 1 deletion packages/json-schema/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ export class Schema<

['x-read-only']?: boolean;

['x-read-pretty']?: boolean
['x-read-pretty']?: boolean;

[key: `x-${string | number}` | symbol]: any

_isJSONSchemaObject = true

Expand Down
4 changes: 3 additions & 1 deletion packages/json-schema/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export type Stringify<P extends { [key: string]: any }> = {
/**
* Use `string & {}` instead of string to keep Literal Type for ISchema#component and ISchema#decorator
*/
[key in keyof P]?: P[key] | (string & {})
[key in keyof P]?: P[key] | `{{${string}}}`
}

export type ISchema<
Expand Down Expand Up @@ -280,4 +280,6 @@ export type ISchema<
['x-read-only']?: boolean

['x-read-pretty']?: boolean

[key: `x-${string | number}` | symbol]: any
}>
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"noUnusedLocals": false,
"preserveConstEnums": true,
"sourceMap": true,
"skipLibCheck": true,
"declaration": true,
"experimentalDecorators": true,
"downlevelIteration": true,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19502,10 +19502,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@4.1.5:
version "4.1.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72"
integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==
typescript@^4.3.0:
version "4.4.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==

ua-parser-js@^0.7.18:
version "0.7.28"
Expand Down

0 comments on commit 67ca5e5

Please sign in to comment.