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

Question: Retrieve JSON Schema definition for a Json Element/Node? #1678

Open
tthiery opened this issue Mar 2, 2024 · 0 comments
Open

Question: Retrieve JSON Schema definition for a Json Element/Node? #1678

tthiery opened this issue Mar 2, 2024 · 0 comments

Comments

@tthiery
Copy link

tthiery commented Mar 2, 2024

I am building a auditing tool for JSON (basically diff them and use annotations to get meaningful audit entries).

Example

Old Data

        {
            "mode": "foo",
            "config": [
                {
                    "id": "backgroundColor",
                    "value": "green"
                }
            ]
        }

New Data

        {
            "mode": "foo",
            "config": [
                {
                    "id": "backgroundColor",
                    "value": "red"
                }
            ]
        }

producing a audit representation as

Setting 'Background Color' > Configuration changed from 'Green' to 'Redish'

I identify the change and have a stack available where the change happens.

I am currently working with a hierarchical annotation (which specify property, key, value, type mappings) model but this becomes equally complex as a schema in the end. Right now it still works since my JSON modelling is quite ... simplistic (object, arrays, Keyed Array, Polymorphic Array). But I would love to put it on a solid ground.

The idea I am exploring is to extend my JSON Schema definitions with private properties (for my auditing purpose) and then fetch that definition whenever I operate on the related nodes.

Question

Is there a way in the NJsonSchema API to look up the schema definition for a given node (stack)? (like a visitor pattern, a helper function, ...)

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

No branches or pull requests

1 participant