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

[Feature Request] Warn for properties marked "deprecated": true in JSON Schema #4114

Open
2 tasks done
Tracked by #4281
eggplants opened this issue Aug 3, 2023 · 5 comments
Open
2 tasks done
Tracked by #4281
Assignees
Labels
feature-request Request for new features or functionality
Milestone

Comments

@eggplants
Copy link

eggplants commented Aug 3, 2023

Context

  • This issue is not a bug report. (please use a different template for reporting a bug)
  • This issue is not a duplicate of an existing issue. (please use the search to find existing issues)

Description

Related?: #277

deprecated is introduced in json-schema Draft 2019-09.
https://json-schema.org/draft/2019-09/release-notes.html#meta-data-vocabulary
https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.3

I would like to warn deprecated properties marked "deprecated": true in JSON Schema like Property p1 is deprecated..

Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.40.0#XQAAAAI3AwAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw3Ei00H9ZIu9-Fa32EzPTwY64-taCjCG3AffhHCYo3PV_ek3Ebg3AG4MZPGWACFnHSU7wDjf4MFRe32SXzHsq_-SzuU7of0BTs3KFauxbLfsiljHbMFtJ_atM7bbmCV5YlXRQSDOQuTdJXO9-pVc6PwBccNCSCXTi_9MTKiCqbBklhn5o22xcBujG6hAbkBvFrX0HNRHiW_rhOlSm-CdgNSSrP3jFVKFLJ6q2TtTCCqbvMsBma_1c3L8GRuSBKIKnmAF_W13B8NvHo0MimAFBYs6MzCpZBETT_xCvjNqTM1BaUDMsrcOBbV1-vZtPLaAdOSP1-k8qdQoBnx2j9Q1hcD8qjS6hixAyj92oJTIHXPBXyTSSPMHoqCFpG6Brb2U95v3qom6pCbZ5d0I0KIsEz9EnISh_1_ZUy-WCJ0iWhQnr3Ga4e9uVc1oXq60lLPsTMiTRk-w21DcXOJ4e44tqXv3eR68VzhMd7mKGCZO86Tu5yx94MYoFO15-QTQZBbEVLXH-T6OC2p_n_Pl3rXr3Vf0y4NGk_bN-WonPym52ANcBcmQqduDcMmrzpTa97jK5gogwIXIVeWi4SAgf_7pEVIA

Monaco Editor Playground Code

// Configures two JSON schemas, with references.

const jsonCode = ["{", '    "p1": "this-is-deprecated-property-value",', '    "p2": false', "}"].join("\n");
const modelUri = monaco.Uri.parse("a://b/foo.json");
const model = monaco.editor.createModel(jsonCode, "json", modelUri);

const schema = {
	$schema: "http://json-schema.org/draft/2020-12/schema#",
	type: "object",
	properties: {
		p1: {
			deprecated: true,
			type: [
				"string"
			]
		},
		p2: {
			type: [
				"boolean"
			]
		},
	},
}

monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
	validate: true,
	schemas: [
		{
			uri: "http://myserver/foo.schema.json",
			fileMatch: ["*"],
			schema,
		},
	],
});

monaco.editor.create(document.getElementById("container"), {
	model,
});

And I would like to warn:

{
    "p1": "this-is-deprecated-property-value",
    ^^^^
    "p2": false
}
@eggplants eggplants added the feature-request Request for new features or functionality label Aug 3, 2023
@eggplants eggplants changed the title [Feature Request] Add warning markers for properties marked "deprecated": true in JSON [Feature Request] Warn for properties marked "deprecated": true in JSON Schema Aug 3, 2023
@FacuLitterio
Copy link

Hi. What is the state of this issue?

@aeschli
Copy link
Contributor

aeschli commented Sep 29, 2023

This has been available in the json-languageservice for quite a while. @hediet We need to update the language service dependencies.

@jrsquared
Copy link

@aeschli any chance of vscode-json-languageservice getting updated soon? Some of our end users are submitted schemas with draft 2020-22 and we cannot support them.

@aeschli
Copy link
Contributor

aeschli commented Nov 29, 2023

@hediet would be great if you could update to the latest vscode-json-languageservice ...

@aeschli
Copy link
Contributor

aeschli commented Nov 29, 2023

Same: #3625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

5 participants