jdorn / json-editor

JSON Schema Based Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Choose which oneOf is used with startval

sdmadden opened this issue · comments

Hi,

Is there a way to choose which of a "oneOf" is used when using startval?

If I have a schema like:

fields: { type: "array", items: { type: "object", oneOf: [ { title: "choice 1", properties: { name: { type: "string" }, type: { type: "string" } } }, { title: "choice 2", properties: { name: { type: "string" }, data: { type: "string" } } } ] } }

and values in startval that either use one of the data or the type fields, the first definition that appears in the schema is always the one that is used when the data is loaded into the editor. Everything is loaded as "choice 1", regardless of whether it has the data field or the type field.

Is there a way to make it use the more appropriate definition (the first one that it matches), rather than the first?

Thanks!

have the same problem.