Skip to content
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

feat(normalisation): jsonNormalisation/v3 and fixes to jsonNormalisation/v1 as well as jsonNormalisation/v2 (#1218) #1230

Conversation

jakobmoellerdev
Copy link
Contributor

@jakobmoellerdev jakobmoellerdev commented Jan 8, 2025

Note that this introduces a json normalization algorithm v3 which technically will break a minor release. however this is needed as we currently broke hashing and need to offer a working alternative. thus it should have been part of v0.19.0 already: #1214

What this PR does / why we need it

Package jsonv3 provides a normalization which is completely based on the abstract (internal) version of the component descriptor and is therefore agnostic of the final serialization format. Signatures using this algorithm can be transferred among different schema versions, as long as is able to handle the complete information using for the normalization. jsonv2 is the predecessor of this version but had internal defaulting logic that is no longer included as part of this normalization. Thus v3 should be preferred over v2. Note that between v2 and v3 differences can occur mainly if the "extra identity" field is not unique, in which case the v2 normalization opinionated on how to differentiate these items. This no longer happens in v3, meaning the component descriptor is normalized as is.

v2 and v1 were adjusted to accomodate the old(but new because forgotten) legacy behavior in legacy.go. Without this, old signatures would not work. This means this should be (at least partially) back-ported to the last minor versioned released without this correction.

Which issue(s) this PR fixes

This issue fixes #1214 and supercedes #1217 as a better solution longterm (by getting rid of the old normalization) and shortterm (by achieving full backwards compatibility + introducing a simple test case)

Note that this changes the default normalization algorithm to be jsonNormalisation/v3 instead of jsonNormalisation/v1 as it is important for users to migrate as soon as possible.

This is a backport of a93ecca in #1218

…ion/v1 as well as jsonNormalisation/v2 (open-component-model#1218)

<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it

Package jsonv3 provides a normalization which is completely based on the
abstract (internal) version of the component descriptor and is therefore
agnostic of the final serialization format. Signatures using this
algorithm can be transferred among different schema versions, as long as
is able to handle the complete information using for the normalization.
jsonv2 is the predecessor of this version but had internal defaulting
logic that is no longer included as part of this normalization. Thus v3
should be preferred over v2. Note that between v2 and v3 differences can
occur mainly if the "extra identity" field is not unique, in which case
the v2 normalization opinionated on how to differentiate these items.
This no longer happens in v3, meaning the component descriptor is
normalized as is.

v2 and v1 were adjusted to accomodate the old(but new because forgotten)
legacy behavior in legacy.go. Without this, old signatures would not
work. This means this should be (at least partially) back-ported to the
last minor versioned released without this correction.

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
This issue fixes open-component-model#1214
and supercedes open-component-model#1217 as
a better solution longterm (by getting rid of the old normalization) and
shortterm (by achieving full backwards compatibility + introducing a
simple test case)

Note that this changes the default normalization algorithm to be
`jsonNormalisation/v3` instead of `jsonNormalisation/v1` as it is
important for users to migrate as soon as possible.
@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner January 8, 2025 08:58
@github-actions github-actions bot added area/documentation Documentation related component/ocm-cli OCM Command Line Interface component/github-actions Changes on GitHub Actions or within `.github/` directory size/m Medium kind/feature new feature, enhancement, improvement, extension labels Jan 8, 2025
@ikhandamirov ikhandamirov merged commit 15a1b50 into open-component-model:releases/v0.19 Jan 8, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Documentation related component/github-actions Changes on GitHub Actions or within `.github/` directory component/ocm-cli OCM Command Line Interface kind/feature new feature, enhancement, improvement, extension size/m Medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants