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

Object-level validation, frontend #3336

Merged
merged 38 commits into from
Mar 2, 2023
Merged

Conversation

fiskus
Copy link
Member

@fiskus fiskus commented Feb 20, 2023

  • Added one more visible state to files - "invalid"
  • Moved entries validation to the function used final-form API (<RF.Field validate={...here...} />)
  • Populate Ajv error with entry context data, and then check if there are added or existing files with that error

Screenshot from 2023-03-02 14-33-10

  • Documentation
  • Changelog entry (skip if change is not significant to end users, e.g. docs only)

@fiskus fiskus changed the title Object-level validation frontend Object-level validation, frontend Feb 20, 2023
@codecov
Copy link

codecov bot commented Feb 20, 2023

Codecov Report

Merging #3336 (f9c2a18) into master (e96df90) will increase coverage by 0.05%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3336      +/-   ##
==========================================
+ Coverage   90.71%   90.76%   +0.05%     
==========================================
  Files          34       34              
  Lines        5662     5662              
==========================================
+ Hits         5136     5139       +3     
+ Misses        526      523       -3     
Flag Coverage Δ
api-python 90.76% <ø> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
api/python/quilt3/data_transfer.py 81.71% <0.00%> (+0.14%) ⬆️
api/python/quilt3/session.py 72.90% <0.00%> (+1.29%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@fiskus fiskus requested a review from nl0 February 24, 2023 14:05
@sir-sigurd sir-sigurd self-requested a review February 27, 2023 15:07
Copy link
Member

@sir-sigurd sir-sigurd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc looks OK but might make sense to use logical_key in example to demonstrate how to validate specific object instead of just some object in package.

docs/advanced-features/workflows.md Show resolved Hide resolved
docs/advanced-features/workflows.md Outdated Show resolved Hide resolved
docs/advanced-features/workflows.md Show resolved Hide resolved
nl0
nl0 previously approved these changes Mar 1, 2023
Copy link
Member

@nl0 nl0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks sane.
i'm not quite sure if you're still showing the validation errors "not assigned" to any entries (or are they not expected to be present at all times?). e.g. if you have some error related to several fields or smth like that. also, you only get (.find()) the first error matching entry path, but can there be more than one per path and they are not shown?

@fiskus
Copy link
Member Author

fiskus commented Mar 2, 2023

i'm not quite sure if you're still showing the validation errors "not assigned" to any entries

Yes, all entries validation errors are below FilesInput. Unfortunately, they are not very helpful, if you don't know exact JSON Schema. At the same time, I don't show error message in entry. There is a room for improvement here, I address it in the next task.

Probably, it's not so important to invest a lot of time into entries meta validation on frontend

you only get (.find()) the first error matching entry path, but can there be more than one per path and they are not shown?

With .find I only find the fact, the entry is invalid. Actual errors are below the FilesInput block.

@fiskus
Copy link
Member Author

fiskus commented Mar 2, 2023

This is not very good UX, of course. For example, if Schema requires README.md with meta, but user provides two files foo.txt and bar.txt, then both files are invalid with two errors each (1. this is not README.md, 2. this doesn't have meta). But actually, files are not invalid, user just need one more file.

…ta/quilt into object-level-validation-frontend
@fiskus
Copy link
Member Author

fiskus commented Mar 2, 2023

Updated docs: added logical_key

nl0
nl0 previously approved these changes Mar 2, 2023
@fiskus fiskus merged commit c245776 into master Mar 2, 2023
@fiskus fiskus deleted the object-level-validation-frontend branch March 2, 2023 17:06
robnewman pushed a commit that referenced this pull request Apr 6, 2023
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 this pull request may close these issues.

3 participants