Documentation
¶
Overview ¶
Package fixedpattern validates fixed[x] and pattern[x] constraints from ElementDefinitions. It uses dynamic extraction from raw JSON to support all FHIR types without hardcoding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsPattern ¶
func ContainsPattern(actual, pattern json.RawMessage) bool
ContainsPattern checks if the actual value contains/matches the pattern. Used for validating pattern[x] constraints where: - For primitives: values must be equal. - For objects: all properties in pattern must exist and match in actual. - For arrays: all items in pattern must be found in actual (order independent).
func DeepEqual ¶
func DeepEqual(actual, expected json.RawMessage) bool
DeepEqual compares two JSON values for exact equality. Used for validating fixed[x] constraints where values must match exactly.
Types ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates fixed[x] and pattern[x] constraints.
func (*Validator) Validate ¶
func (v *Validator) Validate(resourceData json.RawMessage, sd *registry.StructureDefinition, result *issue.Result)
Validate validates fixed/pattern constraints for a FHIR resource. Deprecated: Use ValidateData for better performance when JSON is already parsed.
func (*Validator) ValidateData ¶
func (v *Validator) ValidateData(resource map[string]any, sd *registry.StructureDefinition, result *issue.Result)
ValidateData validates fixed/pattern constraints for a pre-parsed FHIR resource. This is the preferred method when JSON has already been parsed to avoid redundant parsing.