Oasis.Spec (oasis v0.7.0)

Copy Markdown View Source

Loads and prepares OpenAPI documents for Oasis generation.

read/1 is the public file-ingestion entrypoint used by mix oas.gen.plug. It parses YAML or JSON, resolves the structural OpenAPI Reference Objects Oasis consumes, preserves JSON Schema references for JSONSchex, and normalizes path/operation data.

Since the JSONSchex boundary migration, successful reads return an Oasis.Spec.Document rather than the %ExJsonSchema.Schema.Root{} returned by Oasis 0.6. Callers that only need the normalized generation view may inspect document.schema; generation code should retain the complete document so the reference root, source path, pointer sidecars, and URI aliases remain available. Unlike the old eagerly expanded root, Schema Object references remain intact for JSONSchex.

Summary

Functions

Reads and prepares an OpenAPI YAML or JSON document.

Functions

read(path)

@spec read(Path.t()) :: Oasis.Spec.Document.t() | {:error, Exception.t()}

Reads and prepares an OpenAPI YAML or JSON document.

Returns an Oasis.Spec.Document on success. File loading/decoding failures and invalid OpenAPI structures recognized during preparation are returned as {:error, exception} tuples.