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

Description not showing for some fields #984

Open
2 of 4 tasks
roedoejet opened this issue Nov 22, 2023 · 3 comments
Open
2 of 4 tasks

Description not showing for some fields #984

roedoejet opened this issue Nov 22, 2023 · 3 comments

Comments

@roedoejet
Copy link

roedoejet commented Nov 22, 2023

Describe the bug

I have a JSON schema generated by Pydantic has descriptions of certain fields. When I create a json file and validate it with the schema, the descriptions show in VSCode without exception. However, when using the YAML extension and creating a YAML file, some of the descriptions display, and some of them do not (see screenshots below).

Expected Behavior

The description should be present when hovering over all fields that contain a description in the schema.

Current Behavior

Only certain fields display the description.

Steps to Reproduce

  1. Here is an example schema:
{
    "$defs": {
        "FastSpeech2TrainingConfig": {
            "$schema": "http://json-schema.org/draft-07/schema#",
            "additionalProperties": false,
            "properties": {
                "batch_size": {
                    "default": 16,
                    "description": "The number of samples to include in each batch when training. If you are running out of memory, consider lowering your batch_size.",
                    "title": "Batch Size",
                    "type": "integer"
                },
                "save_top_k_ckpts": {
                    "default": 5,
                    "description": "The number of checkpoints to save.",
                    "title": "Save Top K Ckpts",
                    "type": "integer"
                },
                "ckpt_steps": {
                    "anyOf": [{
                            "type": "integer"
                        },
                        {
                            "type": "null"
                        }
                    ],
                    "default": null,
                    "description": "The interval (in steps) for saving a checkpoint. By default checkpoints are saved every epoch using the 'ckpt_epochs' hyperparameter",
                    "title": "Ckpt Steps"
                },
                "ckpt_epochs": {
                    "anyOf": [{
                            "type": "integer"
                        },
                        {
                            "type": "null"
                        }
                    ],
                    "default": 1,
                    "description": "The interval (in epochs) for saving a checkpoint. You can also save checkpoints after n steps by using 'ckpt_steps'",
                    "title": "Ckpt Epochs"
                },

                "$schema": "http://json-schema.org/draft-07/schema#"
            }
        }
    },
    "additionalProperties": false,
    "properties": {
        "path_to_model_config_file": {
            "anyOf": [{
                    "format": "file-path",
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "default": null,
            "title": "Path To Model Config File"
        },
        "training": {
            "$ref": "#/$defs/FastSpeech2TrainingConfig"
        },
        "path_to_training_config_file": {
            "anyOf": [{
                    "format": "file-path",
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "default": null,
            "title": "Path To Training Config File"
        },
        "path_to_preprocessing_config_file": {
            "anyOf": [{
                    "format": "file-path",
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "default": null,
            "title": "Path To Preprocessing Config File"
        },
        "path_to_text_config_file": {
            "anyOf": [{
                    "format": "file-path",
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "default": null,
            "title": "Path To Text Config File"
        }
    },
    "title": "FastSpeech2Config",
    "type": "object"
}
  1. Create a json file:
{
    "$schema": "/path/to/the/schema/above.json",
    "training": { "ckpt_epochs": 1 }
}
  1. Hover over the "ckpt_epochs" key and you will see a description:

image

  1. Create a yaml file and associate it with the same schema, and you will see a description for some fields (i.e. batch_size shown below), but you will not see a description for others (e.g. ckpt_epochs)

image
image

Environment

Tested on macOS Monterey and Windows. For Mac:

Version: 1.84.2 (Universal)
Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
Date: 2023-11-09T10:52:33.687Z (1 wk ago)
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 21.6.0

  • Windows
  • Mac
  • Linux
  • other (please specify)
@roedoejet roedoejet changed the title Description not showing for some fields in VSCode Description not showing for some fields Nov 22, 2023
@LevonW-IIS
Copy link

I have a similar use case and am getting the same issue

@s-weigand
Copy link

s-weigand commented Apr 23, 2024

I also have this issue and found that this is the case for schema entries that use anyOf instead of type.
This also seems to be true for the case in the bug report form @roedoejet where path_to_preprocessing_config_file uses anyOf and batch_size uses type.
There is an identical issue on the LSP-server repo, so depending on which is the right tree to bark at one of the issues is a duplicate.

@ssallmen
Copy link

Just noticed the same issue and was about to report it but fortunately found this existing issue. Also my short analysis led to a conclusion that having anyOf as the type has something to do with this issue.

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

4 participants