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

Support for jsonschema "const" keyword overriding "type" #1328

Open
helt opened this issue Apr 24, 2024 · 0 comments
Open

Support for jsonschema "const" keyword overriding "type" #1328

helt opened this issue Apr 24, 2024 · 0 comments
Labels
Bridge: JSON Schema Affects the uniforms-bridge-json-schema package

Comments

@helt
Copy link

helt commented Apr 24, 2024

If a property does not have a type constraint, form generation will fail.

According to my understanding of the JSONSchema spec, the type constraint is optional, and may be omitted.

For example, the JSONSchema below is valid, and also accepted by ajv.

{
          "properties": {
            "type": { "const": "Visualization", "title": "Type" },
          },
          "required": [],
          "title": "constOverType",
          "type": "object",
        }

uniforms complains

Uncaught Invariant Violation: Unsupported field type: undefined
    at invariant (webpack-internal:///./node_modules/invariant/browser.js:38:15)
    at eval (webpack-internal:///./node_modules/uniforms-mui/esm/AutoField.js:46:60)
    at AutoField (webpack-internal:///./node_modules/uniforms/esm/createAutoField.js:23:27)
    at renderWithHooks (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:16305:18)
    at mountIndeterminateComponent (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:20069:13)
    at beginWork (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:21582:16)
    at HTMLUnknownElement.callCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4164:14)
    at Object.invokeGuardedCallbackDev (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4213:16)
    at invokeGuardedCallback (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:4277:31)
    at beginWork$1 (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:27446:7)
    at performUnitOfWork (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26552:12)
    at workLoopSync (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26461:5)
    at renderRootSync (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26429:7)
    at recoverFromConcurrentError (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:25845:20)
    at performSyncWorkOnRoot (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:26091:20)
    at flushSyncCallbacks (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:12042:22)
    at eval (webpack-internal:///./node_modules/react-dom/cjs/react-dom.development.js:25646:13)
@github-project-automation github-project-automation bot moved this to Needs triage in Open Source May 10, 2024
@piotrpospiech piotrpospiech added the Bridge: JSON Schema Affects the uniforms-bridge-json-schema package label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bridge: JSON Schema Affects the uniforms-bridge-json-schema package
Projects
Status: Needs triage
Development

No branches or pull requests

2 participants