-
Notifications
You must be signed in to change notification settings - Fork 20
Draft: [Experiment] Try to clear old attributes on conditionals #52
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
Conversation
|
|
||
| const updateValues = (fieldValues) => | ||
| const updateValues = (fieldValues) => { | ||
| ['const', 'default', 'minimum', 'maximum', 'minLength', 'maxLength'].forEach((key) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: I don't need to be explicit about the downsides of having a hardcoded list of keys right? So the best we can do for now is to extract this to a function/variable and add a little but important comment about it.
p.s. It's missing readOnly, description, and statement, which are very common too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly, this was thrown together, will improve! ... i think it causes other problems for descriptions, need to investigate exactly what happens
| if (key === 'value') { | ||
| // The value of the field should not be driven by the json-schema, | ||
| // unless it's a read-only field | ||
| // unless it's a read-only field or a forced value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: why do we need this line change?
| expect(handleValidation({ ten_only: null }).formErrors).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('Should clear the default from number when removed from condition', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: Can you check the tests for schemaWithConditionalReadOnlyProperty? Now we should be able to remove the redundant conditional readOnly:false (because it's the default state) and still pass.
|
Closing in favour of #57 |
TODO: fill this in and explain why its a problem