Add Load and Parse methods to the metadata models - #146
Merged
Merged
Conversation
DeviceMetadata gains Load and Parse, and a new PortPinMetadata type gains Load, so each model class reads its own metadata document. Both resolve YAML merge keys, which is new for the port pin path. FirmwareGenerator takes PortPinMetadata in place of the dictionary.. This change also includes two unrelated fixes. A generated interface now throws an exception that names its metadata resource if the resource is missing, and a test now fails if its reference output is missing.
glopesdev
force-pushed
the
load-device-metadata
branch
from
September 20, 2026 09:24
ab7a74a to
1fbc37e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Device and IO pin metadata are now read through the model classes.
DeviceMetadatagainsLoad, which takes a file path or aTextReader, andParse, which takes the document as a string. A newPortPinMetadatatype has the sameLoadpair forios.yml.Parsereads a document that is already in memory, such as thedevice.ymlembedded in a generated interface and exposed asDevice.Metadata.Both methods resolve the YAML merge keys that make schema reuse possible. The port pin path did not resolve them before, so an
ios.ymlthat used a merge key would lose its inherited members, and the reader would report no error. No publishedios.ymluses a merge key today.These methods replace internal read helpers that were not reachable from outside the assembly, which made both
harp-tech/toolkitand the documentation repeat the same six lines.Breaking changes
FirmwareGeneratortakesPortPinMetadatain place ofDictionary<string, PortPinInfo>. A caller that readsios.ymlthroughMetadataDeserializerand passes the dictionary must callPortPinMetadata.Loadinstead.Two unrelated fixes
The generated
GetDeviceMetadatanow throws an exception that names the resource when a device package does not embed itsdevice.yml. The failure would otherwise occur insideStreamReader, with nothing to identify the cause. This is the only change to generated output.AssertExpectedOutputnow fails when the reference output is missing. Seven comparisons on theerrors.ymlfirmware row passed only because their reference files were absent.