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

add a 'json.validate' command #244784

Merged
merged 1 commit into from
Mar 26, 2025
Merged

add a 'json.validate' command #244784

merged 1 commit into from
Mar 26, 2025

Conversation

aeschli
Copy link
Contributor

@aeschli aeschli commented Mar 26, 2025

Allow to validate JSON from core until we have a better solution

When run from core:

		const schemaUri = URI.parse('https://json-schema.org/draft-07/schema');
		const content = JSON.stringify({ type: 'foo' });
		commandService.executeCommand('json.validate', schemaUri, content).then(result => {
			console.log('Validation result', result);
		});

Result:

[
    {
        "severity": "Warning",
        "message": "Value is not accepted. Valid values: \"array\", \"boolean\", \"integer\", \"null\", \"number\", \"object\", \"string\".",
        "range": [
            {
                "line": 0,
                "character": 8
            },
            {
                "line": 0,
                "character": 13
            }
        ],
        "code": 1
    }
]

@aeschli aeschli self-assigned this Mar 26, 2025
@aeschli aeschli enabled auto-merge (squash) March 26, 2025 19:25
@vs-code-engineering vs-code-engineering bot added this to the March 2025 milestone Mar 26, 2025
@aeschli aeschli merged commit c64fbf3 into main Mar 26, 2025
8 checks passed
@aeschli aeschli deleted the aeschli/agreed-antelope-180 branch March 26, 2025 19:39
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.

2 participants