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

createDefaultValue doesn't follow anyOf, oneOf, allOf #2401

Closed
kchobantonov opened this issue Dec 1, 2024 · 1 comment · Fixed by #2402
Closed

createDefaultValue doesn't follow anyOf, oneOf, allOf #2401

kchobantonov opened this issue Dec 1, 2024 · 1 comment · Fixed by #2402
Milestone

Comments

@kchobantonov
Copy link
Contributor

Describe the bug

  1. createDefaultValue returns empty object in the "anyOf" example when new element is added in "Addresses or Users (AnyOf Array Items)"
  2. createDefaultValue should also pass the rootSchema when it tries to resolve the the schema based on schema.$ref

Expected behavior

the createDefaultValue should have returned empty array rather than empty object

we get

{
  "addressOrUser": {
    "street_address": "1600 Pennsylvania Avenue NW",
    "city": "Washington",
    "state": "DC"
  },
  "addressesOrUsersAnyOfItems": [
    {}
  ]
}

instead of

{
  "addressOrUser": {
    "street_address": "1600 Pennsylvania Avenue NW",
    "city": "Washington",
    "state": "DC"
  },
  "addressesOrUsersAnyOfItems": [
    []
  ]
}

Steps to reproduce the issue

  1. Go to generated example app
  2. Select Example 'anyOf'
  3. Scroll down to 'Addresses or Users (AnyOf Array Items)'
  4. Click on the '+' to add new element in "Addresses or Users (AnyOf Array Items)" array
  5. See that added element under addressesOrUsersAnyOfItems is an empty object rather than empty array

Screenshots

No response

Which Version of JSON Forms are you using?

3.4.1

Package

Core

Additional context

No response

@sdirix
Copy link
Member

sdirix commented Dec 6, 2024

Fixed by #2402

@sdirix sdirix closed this as completed Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants