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

getHoverTexts doesn't receive schema's description for tree structure #130

Open
andreyqin opened this issue Jun 11, 2024 · 0 comments
Open

Comments

@andreyqin
Copy link

Hi! I'm implementing a JSON editor and I want the user to get some hints when hovering on a field inside the editor. The issue is that if I have a tree schema structure like below:

const schema = {
    type: 'object',
    properties: {
        props: {
            type: 'array',
            items: {
                type: 'string',
                enum: ['a', 'b', 'c'],
            },
            description: 'This is props field',
        },
        children: {
            type: 'array',
            items: { $ref: '#' },
            description: 'This is children field',
        },
    },
};

getHoverTexts only receives the schema's description for fields on first level of nesting:

{
  "props": ["a"],
  "children": [
    {
      "props": ["b"]
    }
  ]
}

So when hovering on first props, getHoverTexts's callback receives the following schema:

{
    "type": "array",
    "items": {
        "type": "string",
        "enum": [
            "a",
            "b",
            "c"
        ]
    },
    "description": "This is props field"
}

So I get the description and can show it to the end user. But when I'm hovering on the nesting props, I get:

{
    "type": "array",
    "items": {
        "type": "string"
    }
}

And as you can see, the description is missing in this case.

I'm using: node v18.7.0, "codemirror-json-schema": "^0.7.8", "@codemirror/lang-json": "^6.0.1", "@uiw/react-codemirror": "^4.22.1".

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