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

Support Validation with FieldMasks #2

Open
8 tasks done
KrishnaIyer opened this issue Jan 7, 2019 · 0 comments
Open
8 tasks done

Support Validation with FieldMasks #2

KrishnaIyer opened this issue Jan 7, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@KrishnaIyer
Copy link

KrishnaIyer commented Jan 7, 2019

Summary:

The validators must be able to support Fieldmasks in order to make the validation context dependent.

Why do we need this?

The same proto message can have different fields relevant in different rpcs. This selection is made via fieldmasks. Hence, the validation of a field must be dependent on whether it is required by the fieldmask or not.

What is already there? What do you see now?

Validate() functions do not operate on fieldmasks.

What is missing? What do you want to see?

The generated validator would now be of the form Validate(paths []string). Only the paths defined in this fieldmask will be validated. The other fields will be ignored.

How do you propose to implement this?

  • Generate New methods
  • Support Extraction of fieldmasks to fields and propagation to sub-messages.
  • Support repeated messages.
  • Support Maps stubbing
  • Crazy testing

There are some indirect changes that are necessary for the above changes:

  • Improve error handling to easily compare errors for automated testing.
  • Fix improper existing error messages.

Additional

  • Update README and code examples.

What can you do yourself and what do you need help with?

A PR will be available shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant