-
Notifications
You must be signed in to change notification settings - Fork 7
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: added json-schema-form meta schema #6
Merged
sandrina-p
merged 6 commits into
remoteoss:main
from
jguddas:feat/added-json-schema-form-hyper-schema
May 19, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b48fdbf
feat: added json-schema-form hyper schema
jguddas 13a6222
fix: added descriptions and type property to x-jsf-errorMessage
jguddas 4d93ef1
fix: loosened restriction for x-jsf-presentation and inputType
jguddas 2ebb9d4
fix: fixed multiple match error for inputType
jguddas 9e8f1e8
fix: reduced restrictiveness of statement field
jguddas 7eda828
chore: added json-schema-form.schema.json to package.json files
jguddas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,188 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "JSON json-schema-form-Schema", | ||
"definitions": { | ||
"schemaArray": { | ||
"allOf": [ | ||
{ | ||
"$ref": "http://json-schema.org/draft-07/schema#/definitions/schemaArray" | ||
}, | ||
{ | ||
"items": { "$ref": "#" } | ||
} | ||
] | ||
} | ||
}, | ||
"allOf": [{ "$ref": "http://json-schema.org/draft-07/schema#" }], | ||
"properties": { | ||
"additionalItems": { "$ref": "#" }, | ||
"additionalProperties": { "$ref": "#" }, | ||
"dependencies": { | ||
"additionalProperties": { | ||
"anyOf": [{ "$ref": "#" }, { "type": "array" }] | ||
} | ||
}, | ||
"items": { | ||
"anyOf": [{ "$ref": "#" }, { "$ref": "#/definitions/schemaArray" }] | ||
}, | ||
"definitions": { | ||
"additionalProperties": { "$ref": "#" } | ||
}, | ||
"patternProperties": { | ||
"additionalProperties": { "$ref": "#" } | ||
}, | ||
"properties": { | ||
"additionalProperties": { "$ref": "#" } | ||
}, | ||
"if": { "$ref": "#" }, | ||
"then": { "$ref": "#" }, | ||
"else": { "$ref": "#" }, | ||
"allOf": { "$ref": "#/definitions/schemaArray" }, | ||
"anyOf": { "$ref": "#/definitions/schemaArray" }, | ||
"oneOf": { "$ref": "#/definitions/schemaArray" }, | ||
"not": { "$ref": "#" }, | ||
"contains": { "$ref": "#" }, | ||
"propertyNames": { "$ref": "#" }, | ||
"x-jsf-order": { | ||
"description": "This keyword defines the order of fields for a given form or fieldset. It's placed at the schema root and inside of each fieldset.", | ||
sandrina-p marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"$ref": "http://json-schema.org/draft-07/schema#/definitions/stringArray" | ||
}, | ||
"x-jsf-errorMessage": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"description": "Message shown when the value is not of the correct type." | ||
}, | ||
"required": { | ||
"type": "string", | ||
"description": "Message shown when the value is required and not provided." | ||
}, | ||
"minimum": { | ||
"type": "string", | ||
"description": "Message shown when the value is less than the minimum value." | ||
}, | ||
"minLength": { | ||
"type": "string", | ||
"description": "Message shown when the value is less than the minimum length." | ||
}, | ||
"maximum": { | ||
"type": "string", | ||
"description": "Message shown when the value is greater than the maximum value." | ||
}, | ||
"maxLength": { | ||
"type": "string", | ||
"description": "Message shown when the value is greater than the maximum length." | ||
}, | ||
"pattern": { | ||
"type": "string", | ||
"description": "Message shown when the value is not the correct format and does not match the pattern property." | ||
}, | ||
"maxFileSize": { | ||
"type": "string", | ||
"description": "Message shown when the file size is greater than the maximum file size." | ||
}, | ||
"accept": { | ||
"type": "string", | ||
"description": "Message shown when the file type is not accepted." | ||
} | ||
} | ||
}, | ||
"x-jsf-presentation": { | ||
"type": "object", | ||
"description": "Presentation overrides for the schema", | ||
"properties": { | ||
"inputType": { | ||
"description": "Input type for the generated UI field", | ||
"type": "string", | ||
"anyOf": [ | ||
{ | ||
"const": "text", | ||
"description": "Similar to the native HTML input with text type." | ||
}, | ||
{ | ||
"const": "select", | ||
"description": "Similar to the native HTML select element." | ||
}, | ||
{ | ||
"const": "radio", | ||
"description": "Similar to a native HTML input with radio type." | ||
}, | ||
{ | ||
"const": "number", | ||
"description": "Similar to the native HTML input with number type." | ||
}, | ||
{ | ||
"const": "date", | ||
"description": "Expects a value with format YYY-MM-DD." | ||
}, | ||
{ | ||
"const": "checkbox", | ||
"description": "Similar to the native HTML input with checkbox type." | ||
}, | ||
{ | ||
"const": "email", | ||
"description": "Similar to the native HTML input with email type." | ||
}, | ||
{ | ||
"const": "file", | ||
"description": "Similar to the native HTML input with file type." | ||
}, | ||
{ | ||
"const": "fieldset", | ||
"description": "Groups multiple Fields inside. Its expected value is a nested object." | ||
}, | ||
{ | ||
"const": "group-array", | ||
"description": "A list of inputs that can be repeated. Its expected value is an array." | ||
}, | ||
{ | ||
"type": "string", | ||
"description": "Any arbitrary custom inputType you might want to represent your UI Field." | ||
} | ||
jguddas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
}, | ||
"accept": { | ||
"description": "For `inputType: \"file\"`. The accepted file types, as a comma separated string.", | ||
"type": "string" | ||
}, | ||
"description": { | ||
"description": "Field description with HTML. If you don't need HTML, please use the native description keyword.", | ||
"type": "string" | ||
}, | ||
"statement": { | ||
"description": "Special message about the field. Useful in cases where this message is based on the field value.", | ||
"type": "object", | ||
"properties": { | ||
"title": { | ||
"type": "string" | ||
}, | ||
"description": { | ||
"description": "The sentence itself. Might include HTML.", | ||
"type": "string" | ||
}, | ||
"severity": { | ||
"description": "Defines the type of message.", | ||
"anyOf": [ | ||
{ "type": "string", "const": "info" }, | ||
{ "type": "string", "const": "warning" }, | ||
{ "type": "string", "const": "error" }, | ||
{ "type": "string", "const": "success" }, | ||
{} | ||
] | ||
} | ||
} | ||
}, | ||
"maxFileSize": { | ||
"description": "For `inputType: \"file\"`. The maximum file size in KB. It's used to enhanced Yup validation.", | ||
"type": "number" | ||
}, | ||
"addFieldText": { | ||
"description": "Used in `group-array` fields. The button text to add a new field.", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, @jguddas for your contribution! You were the first one 😄 Approved, merging it now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last question @jguddas. You called this "hyper" schema, but in my understanding it's a meta schema, right? A "json hyper-schema" refers to an outdated variant of JSON schemas.
Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right, meta schema is the right term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, merged as
chore:
because this does not influence the library itself (src/
). Thanks again :)