Skip to content

Add Load and Parse methods to the metadata models - #146

Merged
glopesdev merged 1 commit into
harp-tech:mainfrom
glopesdev:load-device-metadata
Sep 20, 2026
Merged

glopesdev merged 1 commit into
harp-tech:mainfrom
glopesdev:load-device-metadata

Conversation

@glopesdev

Copy link
Copy Markdown
Contributor

Device and IO pin metadata are now read through the model classes. DeviceMetadata gains Load, which takes a file path or a TextReader, and Parse, which takes the document as a string. A new PortPinMetadata type has the same Load pair for ios.yml. Parse reads a document that is already in memory, such as the device.yml embedded in a generated interface and exposed as Device.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.yml that used a merge key would lose its inherited members, and the reader would report no error. No published ios.yml uses a merge key today.

These methods replace internal read helpers that were not reachable from outside the assembly, which made both harp-tech/toolkit and the documentation repeat the same six lines.

Breaking changes

FirmwareGenerator takes PortPinMetadata in place of Dictionary<string, PortPinInfo>. A caller that reads ios.yml through MetadataDeserializer and passes the dictionary must call PortPinMetadata.Load instead.

Two unrelated fixes

The generated GetDeviceMetadata now throws an exception that names the resource when a device package does not embed its device.yml. The failure would otherwise occur inside StreamReader, with nothing to identify the cause. This is the only change to generated output.

AssertExpectedOutput now fails when the reference output is missing. Seven comparisons on the errors.yml firmware row passed only because their reference files were absent.

@glopesdev glopesdev added the feature New planned feature label Sep 20, 2026
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
glopesdev merged commit 27a0ab2 into harp-tech:main Sep 20, 2026
9 checks passed
@glopesdev
glopesdev deleted the load-device-metadata branch September 20, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New planned feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant