score-spec / score-go

Reference library for parsing and loading Score files
Apache License 2.0
26 stars 6 forks source link

fix: fixed generated types for workload and resource metadata #25

Closed astromechza closed 9 months ago

astromechza commented 9 months ago

The generated types for metadata and resource.*.metadata were broken because the code generator ignored the additionalProperties and instead generated concrete types without any support for additional metadata entries.

Unfortunately we need the best of both worlds: an arbitrary map, while still checking for required properties during validation.

To fix this we generate the types from a 'modified' version of the spec in which we treat it like a generic map[string]interface{}. This 'modified' version is generated from a Makefile which also allows us to better codify the update-schema process.

The validation continues to use the raw spec file which can validate the required fields within the arbitrary object.

This library will then be imported into score-compose and any other score implementations that can consume it.

Types of changes

Checklist: