eclipsesource/jsonforms-editor

Editor crashes when modifying schema with $id

Closed this issue · 4 comments

Description
Modifying a schema that contains an $id, from the JSON Schema text editor, throws an exception:

polyfills-es2015.js:1 Uncaught Error: schema with key or id "https://www.jsonforms.io/example.json" already exists
    at checkUnique (ajv.js:480)
    at Ajv._addSchema (ajv.js:302)
    at Ajv.compile (ajv.js:113)
    at push../node_modules/@jsonforms/core/lib/reducers/core.js.exports.coreReducer (core.ts:137)
    at updateReducer (react-dom.development.js:15135)
    at Object.useReducer (react-dom.development.js:15932)
    at Object.useReducer (react.development.js:1501)
    at push../node_modules/@jsonforms/react/lib/JsonFormsContext.js.exports.JsonFormsStateProvider (JsonFormsContext.tsx:116)

Only happens if a UI schema is defined as well.

To reproduce
Steps to reproduce the behavior:

  1. Add an id to the existing example schema, e.g. https://www.jsonforms.io/example.json
  2. Add any UI element to the editor, e.g. a VerticalLayout
  3. Go to the JSON Schema editor, click on edit, modify the schema, e.g change minLength of name to 4
  4. Click on Apply and see error

Fix is available in jsonforms: eclipsesource/jsonforms#1620

Fixed in jsonforms, keeping this ticket open to update when a new release is available.

@AlexandraBuzila I think this is done with be65ba4

Yes, it's fixed now. Closing this.