简体   繁体   English

如何让Visual Studio 2013使用自定义JSON模式?

[英]How can I get Visual Studio 2013 to use a custom JSON schema?

I am working on a project that involves the use of JSON to store and retrieve data; 我正在开发一个涉及使用JSON来存储和检索数据的项目; in order to write some example data I am using VS2013's JSON editor, which supports, supposedly, the use of arbitrary JSON schema for its Intellisense code-completion feature. 为了编写一些示例数据,我使用的是VS2013的JSON编辑器,它支持使用任意JSON模式来实现其Intellisense代码完成功能。 However, I have not been able to get it to recognise any schemata that are not accessed through a website, eg http://json-schema.org/draft-04/schema works fine but /JSON/mySchema.json does not. 但是,我无法识别任何未通过网站访问的模式,例如http://json-schema.org/draft-04/schema工作正常,但/JSON/mySchema.json没有。

It will not load /JSON/mySchema.json from the $schema tag, nor will it allow me to type in its name; 它不会从$ schema标签加载/JSON/mySchema.json,也不会允许我输入其名称; whenever I type it into the schema box and hit enter, it returns the schema box to "No Schema Selected". 每当我在模式框中键入并按Enter键时,它都会将模式框返回到“No Schema Selected”。

How do I get VS2013 to recognise my custom schema and generate Intellisense completion from it? 如何让VS2013识别我的自定义架构并从中生成Intellisense完成?

I've learned (from comments on the announcement page for this functionality) that using relative paths for JSON schema is currently bugged in Visual Studio 2013 Update 3; 我已经了解到(在此功能的公告页面上的评论)使用JSON模式的相对路径目前在Visual Studio 2013 Update 3中出现错误;

"[...] the relative $schema path is not working in a non-web project and will be fixed in Update 4." “[...]相对$架构路径在非Web项目中不起作用,将在Update 4中修复。”

(from a comment on this page ) (来自此页面的评论)

It should work fine with an absolute path, but of course that's not portable. 它应该可以在绝对路径下正常工作,但当然这不是便携式的。 Update 4 should be out soon; 更新4应该很快就会出来; the RC is already out, and information can be found here . RC已经出来了,可以在这里找到相关信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM