jsonforms icon indicating copy to clipboard operation
jsonforms copied to clipboard

Default value for const

Open cihad opened this issue 1 year ago • 1 comments

Describe the bug

If we have:

export const sampleSchema = {
  type: "object",
  title: "OAuth Providers",
  oneOf: [
    {
      properties: {
        type: { const: "Google" },
        secretKey: { type: "string" },
      },
    },
    {
      properties: {
        type: { const: "Github" },
        callbackUrl: { type: "string" },
      },
    },
  ],
};

When switching between tabs, the createDefaultValue function fills the data with default values, but the type property is not included in data because it does not have an default value.

Expected behavior

createDefaultValue function should consider only const values and not default values when switching between tabs in oneOf tab selector.

Steps to reproduce the issue

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Screenshots

No response

Which Version of JSON Forms are you using?

v3.4.1

Package

Core

Additional context

No response

cihad avatar Nov 29 '24 12:11 cihad