Skip to content

[SYNPY-1787] Changed conditionals so that the watched property is required#1334

Merged
andrewelamb merged 1 commit intodevelopfrom
SYNPY-1787
Mar 5, 2026
Merged

[SYNPY-1787] Changed conditionals so that the watched property is required#1334
andrewelamb merged 1 commit intodevelopfrom
SYNPY-1787

Conversation

@andrewelamb
Copy link
Contributor

@andrewelamb andrewelamb commented Mar 4, 2026

Problem:

Conditional properties like:

    "if":{
                "properties":{
                    "Diagnosis":{
                        "enum":[
                            "Cancer"
                        ]
                    }
                }
            },
            "then":{
                "properties":{
                    "FamilyHistory":{
                        "not":{
                            "type":"null"
                        }
                    }
                },
                    "required":["FamilyHistory"]

weren't quite working right in the Curator UI. The watched property needs to be required:

"if":{
                "properties":{
                    "Diagnosis":{
                        "enum":[
                            "Cancer"
                        ]
                    }
                },
                "required": ["Diagnosis"]
            },
            "then":{
                "properties":{
                    "FamilyHistory":{
                        "not":{
                            "type":"null"
                        }
                    }
                },
                    "required":["FamilyHistory"]
            }

Solution:

The function that creates conditionals has been changed to add the required statement to the if statement.

Testing:

The existing tests have been updated.

@andrewelamb andrewelamb requested a review from a team as a code owner March 4, 2026 15:26
@andrewelamb andrewelamb marked this pull request as draft March 4, 2026 15:26
@andrewelamb andrewelamb changed the title changed conditionals so that the watched property is required [SYNPY-1787] Changed conditionals so that the watched property is required Mar 4, 2026
@andrewelamb andrewelamb marked this pull request as ready for review March 4, 2026 15:30
Copy link
Member

@BryanFauble BryanFauble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice fix — adding required to the if block is the right approach per the JSON Schema spec. The Jira ticket writeup was really thorough too, thanks for that.

Note: This comment was drafted with AI assistance and reviewed by me for accuracy.

@andrewelamb andrewelamb merged commit 5a40d1e into develop Mar 5, 2026
22 of 28 checks passed
Copy link
Contributor

@linglp linglp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewelamb
Copy link
Contributor Author

@linglp Not a problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants