jdorn / json-editor

JSON Schema Based Editor
MIT License
5.81k stars 1.08k forks source link

Is it possible to switch types in an array? #759

Open yongjun23 opened 7 years ago

yongjun23 commented 7 years ago

hi there :)

In my schema I defined two types, torque tool and operator. In my array, named Recipe, each item can be either a torque tool or an operator. Is it possible to switch between these two types every time I add a new item?

In the generated UI, I see an empty “item” drop list. Is this a place I'm supposed to see "torque too" and "operator"? What do I miss?

Please use the link below to view the model, as well at it's generated UI.

http://jeremydorn.com/json-editor/?schema=N4IgJgpgZglgdjALjA9nAziAXKRKBOAjgK4R4oA22ok6AxvjAA7JrYgC8X3P3ABPgjoUxfHQh9EATyYQskgiTIpKfXuvUgANCGmz2KAEYArCHUTaQTfCln5kQ6iDgBDALYQnez1hDpEjHAA5iAAvjreXjI+fgHwIeFWLvjuZBD4mDi60QYmZhY61rbpDpmgTOhkUfq+cMRuhulhOsYo8Mhg1TH+gQk6AG7p6KhwXew98WGJgiQwgp1YANpWlRYAuqGbOsUpePhOtAzMrKO+GuoCQiJiEt7yOy57aufnlpG+RqbmlkV2pU6uDxjXwTYLNbI1XA5EFxMGJJjJVKIIbAkCffI/Gx/GCOLIAWQAkgB9AAy8AA1qi6g0mokAMIuOD9FzoAAq0KhNVivXBeIAykS6Sg3EwKGlUaC+iA8YziC4KAAxFwwCiiCAAQQoFBQAHcIAtOTFDCoxYzwQA1GDDQxi1HGygQM2JVkpeCTLLvbmTLYgGbEOb67DLF3KhBgnSW622nT8wXC0XimPEslwSlrHQuMBgJAjeUABSxJRxmSg8sqmx9nvR30KhfsxacgjozB8NCERxYI3YLx4l2bsmePd4b2haLyNasdf+WUEwlE4jKEJiyRSUksSAgbkXaAgAHkoEHQAASQQH3wAYgA9JBYAgTuhL3slOQqOFj6f2Feb2775eHnswg2CtNiAAAA==&value=N4IgTgpgxglgDhEAuUkDOB7ArmKE3IDaAugL6lAA&theme=bootstrap2&iconlib=fontawesome4&object_layout=normal&show_errors=interaction

tulir commented 7 years ago

Try setting titles for the two types.

yongjun23 commented 7 years ago

Works like a charm! Thank you tulir!