fix(proto_optional_fields): loosen schema validators to only check fo… #381
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.
…r existence of previously required fields
Summary
Doc with more context and info: https://docs.google.com/document/d/1_yFcP8PWHEvrgpTLA_7fAYsxBlqQrBDQfD6J18DC7jE/edit?usp=sharing
Tl;dr: Due to LI's Protobuf migration, the "required" concept is no longer available in Proto3 (versus PDL). GMA previously relies on schema validators to check that model definitions contain certain required fields, notably "urn" and "aspects" fields. As such, the schema validation check requirements must be loosened to support the transition to Proto3.
For all cases where schema validation happens, do a check to make sure that the previously required field indeed exists, but do not check if it's an optional or required field. In the case that an expected field does not even exist, throw an InvalidSchemaException.
Where possible, enforce that the "urn" and "aspects" fields are non-null. These runtime checks will help to ensure that bad data does not get ingested or created. In the case that a non-null field is found to be null, throw a NullFieldException.
Testing Done
Unit tests are added to cover all of the new use cases where null fields or missing fields could happen.
Checklist