Skip to main content

validate_parameters

Function validate_parameters 

Source
pub fn validate_parameters(
    parameters: &Parameters,
    operation_params: &[OperationDefinitionParameter],
    direction: &BoundCode<OperationParameterUse>,
) -> Result<(), OperationOutcomeError>
Expand description

Validates supplied [Parameters] against the [OperationDefinitionParameter] definitions for the specified operation direction.

The validation checks parameter cardinality, validates the type of supplied values or resources against the expected parameter type, recursively validates nested parts, and reports parameters that are not defined for the specified direction.

§Arguments

  • parameters - The parameters supplied for the operation.
  • operation_params - The parameter definitions from the operation’s [OperationDefinitionParameter].
  • direction - The operation parameter direction to validate, such as in or out.

§Errors

Returns an OperationOutcomeError containing one or more issues if:

  • A parameter has fewer occurrences than its minimum cardinality.
  • A parameter exceeds its maximum cardinality.
  • A supplied parameter has a different type than the type defined by the operation.
  • A nested parameter part does not satisfy its corresponding definition.
  • A supplied parameter is not defined for the specified operation direction.

Multiple validation failures are collected and returned together in a single OperationOutcomeError.