-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
return &resolved, nil | ||
} | ||
|
||
func (f *folderSchemaSpec) patchForVersion(target semver.Version) ([]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
versions
key keeping the newer versions on top.It also removes usages of
errors.Wrapf
in files undercode/go/internal/specschema
module.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/packages
that prove my change is effective.specschema
andvalidator
modulesspec/changelog.yml
.Related issues