
Download and record reviewed copies of remote schema references
Source:R/schema_references.R
freeze_references.RdExplicitly download remote $ref target documents and record them in specmill-references.yml beside a local schema, so parsing and generation resolve them offline.
Value
Invisibly, a data frame with url, file, sha256 and status: added, refreshed, restored (local copy rewritten to the recorded bytes) or unchanged.
Details
This is the only specmill function that fetches schema dependencies. Parsing, validation, generation and generated clients stay offline.
New files are stored under references/<host>/<path> inside the lock
directory. Existing entries keep their file. Each download must parse as
YAML when its file ends in .yaml or .yml, and as JSON otherwise.
All URLs are downloaded and checked before any file or the lock changes; an
unchanged re-run leaves the lock untouched. Rewriting the lock drops YAML comments written
by hand.
Nested references are not followed. After freezing, read_operations()
reports any remaining unmapped URL as external_reference; review it and
freeze it too. Review downloaded content before committing it.
Examples
if (FALSE) { # \dontrun{
freeze_references(
"schema/openapi.json",
"https://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml"
)
read_operations("schema/openapi.json")$diagnostics
} # }