Search documentation of Metastatic

# Metastatic.Supplemental.Validator (Metastatic v0.13.2)

View Source

Validates supplemental module availability and compatibility.

Analyzes MetaAST documents to detect required supplemental modules and checks if they are registered and compatible.

## Summary

### Functions

analyze(document, target_language)

Analyzes a document to detect required supplementals for target language.

compatible?(document, target_language)

Checks if all required supplementals are available for a language.

detect_required_constructs(meta_ast)

Lists all supplemental-requiring constructs in a MetaAST.

## Functions

# analyze(document, target_language)

    @spec analyze(Metastatic.Document.t(), atom()) :: {:ok, map()} | {:error, map()}

Analyzes a document to detect required supplementals for target language.

Returns analysis result with required and available supplementals.

## Examples

    iex> Validator.analyze(document, :python)
    {:ok, %{required: [:actor_call], available: [:actor_call], missing: []}}

    iex> Validator.analyze(document_with_actors, :python)
    {:error, %{required: [:actor_call], available: [], missing: [:actor_call]}}

# compatible?(document, target_language)

    @spec compatible?(Metastatic.Document.t(), atom()) :: boolean()

Checks if all required supplementals are available for a language.

## Examples

    iex> Validator.compatible?(document, :python)
    true

# detect_required_constructs(meta_ast)

    @spec detect_required_constructs(term()) :: [atom()]

Lists all supplemental-requiring constructs in a MetaAST.

## Examples

    iex> Validator.detect_required_constructs(meta_ast)
    [:actor_call, :spawn_actor]