score-spec / score-go

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

feat: provide methods shared with score-compose for score implementation #32

Closed astromechza closed 7 months ago

astromechza commented 8 months ago

I'd like to make it easier to build alternative implementations of Score using the score-go library. So I've copied over some bits of score-compose (https://github.com/score-spec/score-compose/tree/main/internal/project, and https://github.com/score-spec/score-compose/blob/main/internal/command/override_utils.go) into score-go.

The major common parts are:

  1. Applying map or path based overrides to the decoded yaml, here these have been re-implemented to not modify the input data structure.
  2. Reading one or more score structures into an in-memory state object along with implementation-specific extras
  3. Resolving a topologically-sorted list of resources and evaluating placeholders within them

These are mechanisms used in score-compose that are common to other implementations like score-flyio and the one internal to Humanitec.