Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad selection of the oneOf on load. #3245

Closed
jma opened this issue Mar 29, 2022 · 5 comments
Closed

Bad selection of the oneOf on load. #3245

jma opened this issue Mar 29, 2022 · 5 comments
Labels

Comments

@jma
Copy link

jma commented Mar 29, 2022

Description
When a oneOf JSONSchema contains an array with a "minItems" property the form is not able to select the right option.

Minimal Reproduction

Go to: https://stackblitz.com/edit/angular-yne8as?file=src/assets/json-schema/oneOf.json

The selection option1 is selected instead of option2. Remove the "minItems" property and the option2 is selected.

Your Environment

  • Angular version: 7.2.16
  • Formly version: 5.11.2

Additional context
Add any other context about the problem here.

@jma jma added the bug label Mar 29, 2022
@aitboudad aitboudad added question and removed bug labels Mar 29, 2022
@aitboudad

This comment was marked as off-topic.

@jma

This comment was marked as off-topic.

@aitboudad

This comment was marked as off-topic.

@aitboudad
Copy link
Member

Sorry I've answered on the wrong issue

@aitboudad
Copy link
Member

This issue has been fixed and released as part of v5.12.0 release.

Please note that passing oneOf at the root level with mixed type (array or object) is not supported, so use one of the following syntax:

  1. Solution 1
{
  type: 'object',
  properties: {
    foo: {
      oneOf: [
        { type: 'object' },
        { type: 'array' }
      ],      
    }
  }
}
  1. Solution 2
{
  type: 'object',
  oneOf: [
    { properties: { foo: { type: 'object' } } },
    { properties: { foo: { type: 'array' } } },
  ],
}

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants