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

Validation of choices with titles fails? #102

Closed
fledman opened this issue Oct 7, 2024 · 1 comment
Closed

Validation of choices with titles fails? #102

fledman opened this issue Oct 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@fledman
Copy link

fledman commented Oct 7, 2024

Given an array schema with choices, if the choices have titles, validation fails with Invalid choice + "<value of first selected item>"

I have made a simplified demonstration using the validation section of the playground

enter this schema:

{
  "title": "Press \"Submit\" to validate data",
  "type": "array",
  "items": {
    "type": "string",
    "choices": [
      {"value": "RED", "title": "Thing One"},
      {"value": "BLUE", "title": "Thing Two"},
      {"value": "GREEN", "title": "Who Knows?"}
    ]
  },
  "minItems": 1,
  "uniqueItems": true
}

Validation submission fails like this:
Screenshot 2024-10-07 at 2 40 35 PM

However, if the titles are removed and we just have an array of choices, then it submits fine:

{
  "title": "Press \"Submit\" to validate data",
  "type": "array",
  "items": {
    "type": "string",
    "choices": ["RED", "BLUE", "GREEN"]
  },
  "minItems": 1,
  "uniqueItems": true
}
Screenshot 2024-10-07 at 2 39 39 PM
@bhch bhch added the bug Something isn't working label Oct 8, 2024
@bhch bhch closed this as completed in 18b91ac Oct 8, 2024
@bhch
Copy link
Owner

bhch commented Oct 8, 2024

Fixed in v2.14.3.

Also released in django-jsonform v2.23.1.

Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants