Skip to main content

Crate haste_artifact_patcher

Crate haste_artifact_patcher 

Source
Expand description

Applies patches and rules to externally provided FHIR artifacts (for example the HL7 core package) without editing the files that came from upstream.

A package opts in with a patches/manifest.toml:

# Upstream files or directories, relative to this manifest. Every `*.json`
# resource found is patched and written next to it as `<name>.min.json`.
sources = ["../definitions/hl7"]

# Rules are transforms implemented in Rust (see `rules`) that run over every
# resource, optionally limited to some resource types.
[[rules]]
name = "clippy-doc-markdown"

Every other *.json file under patches/ is a PatchFile: a description plus RFC 6902 JSON Patch operations scoped to a single resource, which is addressed by resourceType and id or url rather than by its position in a bundle.

The pipeline for each resource is: targeted patches (in file path order), then rules (in manifest order), then minimization. Every change made by a patch or rule is recorded as a Change, so the complete set of differences from upstream can be listed without diffing the output files.

Modules§

rules
Rules are transforms written in Rust that apply across many resources, for changes that are impractical as targeted patches. A manifest enables a rule by its Rule::name.

Structs§

Build
Change
One edit to an upstream resource. None means the value is absent.
Output
A file produced by build.
PatchFile
A file of targeted edits to upstream resources.
ResourcePatch
Target
Identifies one resource across all sources of a package.

Enums§

Error
Origin
What produced a Change.

Functions§

build
Reads the manifest at manifest_path, applies its patches and rules to the upstream sources, and returns the files to write and every change made. Nothing is written to disk.