SelectoComponents.QueryContract.IntentValidator (selecto_components v0.4.8)

Validates generated query intents against a query contract artifact.

This module is intentionally non-executing. It checks whether a proposed intent only references fields, comparators, and sort fields exposed by the contract, but it does not build or run a Selecto query.

Link to this section Summary

Link to this section Types

Link to this type

diagnostic()

@type diagnostic() :: %{
  :code => atom(),
  :path => String.t(),
  :message => String.t(),
  optional(:field) => String.t(),
  optional(:value) => term(),
  optional(:allowed) => [String.t()]
}
@type result() :: %{
  valid?: boolean(),
  errors: [diagnostic()],
  warnings: [diagnostic()]
}

Link to this section Functions

Link to this function

validate(contract, intent, opts \\ [])

@spec validate(map(), map(), keyword()) :: result()