Skip to content

Commit

Permalink
Add support for checking the cardinality of Reference data types
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 691054613
  • Loading branch information
FHIR Team authored and copybara-github committed Oct 29, 2024
1 parent 3f05bae commit ed71c67
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,13 @@ def _encode_required_field(
if constraint_key in self._options.skip_keys:
return None # Allows users to skip required field constraints.

# Early-exit if any types overlap with `_SKIP_TYPE_CODES`.
# Early-exit if any types overlap with `_SKIP_TYPE_CODES`. Reference types
# are not fully supported but do support cardinality constraints, so
# we add them back here.
type_codes = _utils.element_type_codes(element)
if not _SKIP_TYPE_CODES.isdisjoint(type_codes):
if 'Reference' not in type_codes and not _SKIP_TYPE_CODES.isdisjoint(
type_codes
):
return None

result = self._encode_fhir_path_builder_constraint(
Expand Down

0 comments on commit ed71c67

Please sign in to comment.