Skip to content

fix: conversion of JsonObject to Constraint - #5939

Open
ndr-brt wants to merge 1 commit into
mainfrom
5792-fix-serialization
Open

fix: conversion of JsonObject to Constraint#5939
ndr-brt wants to merge 1 commit into
mainfrom
5792-fix-serialization

Conversation

@ndr-brt

@ndr-brt ndr-brt commented Aug 4, 2026

Copy link
Copy Markdown
Member

What this PR changes/adds

Add missing unwrapping of JsonValue types also when the input is a JsonArray.

Why it does that

Avoid weird serialized types when Constraing.rightOperand is an array

Further notes

THIS IS A BREAKING CHANGE: until 0.18.0, when a rightOperand of a Constraint type in a PolicyDefinition contained a List, it would got stored into database as something like:

    "rightOperand": {
        "value":[{
            "@value":{"valueType":"STRING","chars":"item1","string":"item2"}
        },{
            "@value":{"valueType":"STRING","chars":"item2","string":"item2"}
        }]   
    }

this because the incoming JsonArray from the API's json-ld was not unwrapped and the type was stored as it was.
So, if in your control-plane do you have PolicyDefinitions with a multi-value rightOperand, you should migrate every one of those into:

    "rightOperand": {
        "value":["item1", "item2"]
    }

It could become tricky to write an automatic script to do that, so our advice would be to update the affected policies with an API call passing the same bodies that were used to create them.

Please also note that if you adapted your policy functions to workaround this bug, you'll need to update them as well.

Who will sponsor this feature?

Please @-mention the committer that will sponsor your feature.

Linked Issue(s)

Closes #5792
Related to #5934

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

@ndr-brt
ndr-brt requested a review from a team as a code owner August 4, 2026 13:53
@ndr-brt ndr-brt added the bug Something isn't working label Aug 4, 2026
@ndr-brt
ndr-brt force-pushed the 5792-fix-serialization branch from 6f6b6c9 to fdbda2a Compare August 4, 2026 14:34
@ndr-brt ndr-brt added the breaking-change Will require manual intervention for version update label Aug 4, 2026
@ndr-brt
ndr-brt requested a review from a team August 4, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Will require manual intervention for version update bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array-valued rightOperand is serialized as String in PolicyDefinition and Catalog responses

3 participants