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

Jsonschema array tuples can lead to submittable forms that don't meet the schema #2862

Closed
camden-penn opened this issue May 25, 2021 · 3 comments
Labels

Comments

@camden-penn
Copy link

Description
The Formly array component doesn't have a way to distinguish between list-validation arrays and tuple-validation arrays. This can cause problems because tuple-validation means the position of elements matters. As the current implementation seems to assume list-validation, always allowing users to delete items from the middle of an array, it is possible for a user to arrive at a form that believes itself valid without actually meeting the schema.

Minimal Reproduction
https://stackblitz.com/edit/formly-jsonschema-tuple-shenanigans?file=src%2Fassets%2Fjson-schema%2Ftuple.json

Your Environment

  • Angular version: 10.2.5
  • Formly version: 5.10.20

Additional context
This minimal example was based on the second negative example under json-schema.org's explanation of tuple validation.

@camden-penn camden-penn changed the title Jsonschema array tuples can lead to invalid, but submittable, forms Jsonschema array tuples can lead to submittable forms that don't meet the schema May 25, 2021
@aitboudad
Copy link
Member

@camden-penn
Copy link
Author

If the array component knew whether it was working with a list or a tuple, couldn't it simply not let the user delete from the middle of the tuple? As far as I can tell, that would prevent the problem from happening in the first place.

@aitboudad
Copy link
Member

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

Please let us know, in case you are still encountering a similar issue/problem.
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