json-editor icon indicating copy to clipboard operation
json-editor copied to clipboard

Choose which oneOf is used with startval

Open sdmadden opened this issue 8 years ago • 1 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!

sdmadden avatar Oct 19 '17 10:10 sdmadden

have the same problem.

shexiaogui avatar Oct 30 '17 09:10 shexiaogui