Skip to content
Discussion options

You must be logged in to vote

Which means that Build is called a lot with data that's not valid.

It's important to distinguish between "invalid data" and "data that doesn't apply to this factory".

Validate does two things:

  • Decide whether the values apply to this factory at all (the returned bool)
  • If it does, populate the errors list (on the context argument) for everything wrong

Build should check whether the values apply to this factory, and if yes, do something interesting.
YARP won't call Build if the factory applies, but the input is invalid.

So you don't have to reimplement Validate instead of Build - you can choose to assume that inputs are already valid. You do still have to check if the factory applies at …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Ghostbird
Comment options

Answer selected by Ghostbird
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants