Add structured field and rule paths to Violation #265
+5,295
−1,349
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new structured field path format, and uses it to provide a structured path to the field and rule of a violation.
buf.validate.FieldPathElement
is added.repeated_field[1]
buf.validate.FieldPath
is added. It just contains a repeated field ofbuf.validate.FieldPathElement
repeated buf.validate.FieldPathElement
anywhere a path is needed to save a level of pointer chasing, but it is inconvenient for certain uses, e.g. comparing paths withproto.Equal
.buf.validate.Violation
fields are added:field
andrule
, both of typebuf.validate.FieldPath
. The oldfield_path
field is left for now, but deprecated.Note that there are a number of very subtle edge cases:
FieldConstraints
message. (In other cases,constraint_id
is always sufficient anyways, but we can change this behavior later.)