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

Multiple type support #68

Closed
elbakerino opened this issue Oct 13, 2020 · 1 comment
Closed

Multiple type support #68

elbakerino opened this issue Oct 13, 2020 · 1 comment
Labels
json-schema-spec Relates to official JSON-Schema Spec.
Milestone

Comments

@elbakerino
Copy link
Member

Multiple types type: ["boolean", "null"] could be possible when widget is set for those.

Currently nothing will work with multiple types, but the actual implementation - if the ui is not selected by type - should be rather simple. The refactoring of existing usages may be the more problematic part.

The "used-for-validation" type can be get with the first plugin / after combination & referencing is executed. If not undefined and one of the specified types is valid, this type is used, otherwise "type-error" is set - but e.g. all further validators must do nothing then as no type can be used for "should the validator do something".

@elbakerino
Copy link
Member Author

elbakerino commented Jul 3, 2021

Implemented multiple type support, validators support JSON-Schema spec..

But rendering needs:

  • custom widgets, handling "which type should be entered"
  • using simple only one-scalar types and null for nullables, e.g.: "type": ["string", "null"]
    • as null is not counted as "input type" by schemaTypeToDistinct

Utility functions:

  • import { schemaTypeToDistinct } from '@ui-schema/ui-schema/Utils/schemaTypeToDistinct';
  • import { schemaTypeIs } from '@ui-schema/ui-schema/Utils/schemaTypeIs'
  • import { schemaTypeIsAny } from '@ui-schema/ui-schema/Utils/schemaTypeIs'
  • import { schemaTypeIsNumeric } from '@ui-schema/ui-schema/Utils/schemaTypeIs'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
json-schema-spec Relates to official JSON-Schema Spec.
Projects
None yet
Development

No branches or pull requests

1 participant