Add support for JSON patches in folder spec files#540
Conversation
🌐 Coverage report
|
JSON patches need to be defined keeping the patches for newer versions on top.
|
|
||
| newSpec, err := folderSpec.resolve(l.specVersion) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
This is where JSON patches are read and applied.
|
test integrations |
|
Created or updated PR in integrations repostiory to test this vesrion. Check elastic/integrations#6587 |
| return &resolved, nil | ||
| } | ||
|
|
||
| func (f *folderSchemaSpec) patchForVersion(target semver.Version) ([]byte, error) { |
There was a problem hiding this comment.
Maybe we can move some of this common functionality to a shared package. No need to do it in this PR unless you see it would be straightforward.
| func (f *folderSchemaSpec) patchForVersion(target semver.Version) ([]byte, error) { | |
| func PatchForVersion(target semver.Version, versions specpatch.Version) ([]byte, error) { |
There was a problem hiding this comment.
I did some refactor to extract that logic and create a new module specpatch.
|
test integrations |
|
test integrations |
|
Created or updated PR in integrations repostiory to test this vesrion. Check elastic/integrations#6587 |
|
Failures in the integrations PR elastic/integrations#6587 are not related to any issue with package validation. |
What does this PR do?
This PR adds support to define JSON patches at folder specs (
spec.yml) files too.It also ensure that JSON patches are defined in
versionskey keeping the newer versions on top.It also removes usages of
errors.Wrapfin files undercode/go/internal/specschemamodule.Why is it important?
This is important to allow us to remove/add/replace files or folders depending on the spec version used by the package.
Checklist
test/packagesthat prove my change is effective.specschemaandvalidatormodulesspec/changelog.yml.Related issues