AshScim.Patch.Path (ash_scim v0.1.0)

Copy Markdown View Source

Parser for SCIM 2.0 PATCH path expressions (RFC 7644 §3.5.2).

A PATCH path is one of:

  • attr — a top-level attribute (e.g. userName)
  • attr.sub — a complex sub-attribute (e.g. name.givenName)
  • attr[filter] — a filter against a multivalued attribute (e.g. emails[type eq "work"], members[value eq "abc-123"])
  • attr[filter].sub — a sub-attribute of a filter-matched element (e.g. emails[type eq "work"].value)

The parser returns a struct describing the parts so callers can decide how to apply each kind. The bracket filter is parsed via AshScim.Filter to validate its syntax.

Note: AshScim.Filter.parse/2 does both parse and resolve. The resolver requires a resource so it can map SCIM names to Ash attributes. We accept the resource here too, so any attribute names referenced inside the bracket filter are validated against the resource's mappings.

Summary

Functions

Parse path against the resource's SCIM mappings.

Types

t()

@type t() :: %AshScim.Patch.Path{
  attribute: String.t(),
  extension: String.t() | nil,
  filter: %{} | nil,
  relationship: atom() | nil,
  sub_attribute: String.t() | nil
}

Functions

parse(path, resource)

@spec parse(String.t(), module()) :: {:ok, t()} | {:error, term()}

Parse path against the resource's SCIM mappings.

Returns {:ok, %AshScim.Patch.Path{}} or {:error, reason}.