json - 是否可以使用 Eclipse 自动完成 JSON 模式和文档?

标签 json eclipse jsonschema json-schema-validator

我有一个巨大的 JSON 设置文件,用于我的一个项目。我想通过 JSON 模式编写一些文档和验证规则,以便不熟悉该文件的人更容易编辑该文件。

我希望能够在 Eclipse 中打开 json 设置文件,并通过智能感知自动完成 json 属性。我还想在鼠标悬停在任何 json 设置属性上时查看其文档注释。

我找不到有关此功能的任何类型的文档。这可以用 eclipse 实现吗?

最佳答案

我会回答我自己的问题,因为我发现这样做的方法非常简单并且效果很好。

所以,

· Having a test.json file which contains the setup of your project which you want to get autocomplete features on

· Having a c:\test.schema.json file which contains the schema for your setup file

在 eclipse 上激活此功能的步骤是:

1- Open eclipse

2- go to "Window > Preferences: JSON > JSON Catalog"

3- add a new entry with "test.json" as the file and "file:/c:/test.schema.json" as the URL

4- enable syntax and schema validation under "Window > Preferences: JSON > JSON Files > Validation"

5- Apply the changes

6- Open the test.json file with eclipse and check that ctrl + space performs autocomplete

我发现这个过程中唯一乏味的部分是每次修改 json 架构文件时,您都必须再次转到“窗口 > 首选项:JSON > JSON 目录”并再次应用更改刷新新值

关于json - 是否可以使用 Eclipse 自动完成 JSON 模式和文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51983779/

相关文章:

javascript - 将字符串传递给函数以用作 javascript/jquery 中的对象

django - 在 Django Rest Framework 中,如何将值序列化为值数组而不是对象数组?

java - 非常轻量级的 Eclipse-Maven 集成 - 仅依赖项管理?

eclipse - 如何在 Eclipse Web 项目中禁用 "autodeploy"到服务器功能

ruby-on-rails - 使用引用对象树查询结果 - Ruby on Rails

javascript - 为什么只有部分 JSON 数据而不是全部发送到 DOM?

jquery - 用于 jQuery Eclipse 集成的 Aptana 和 jQueryWTP 的替代方案

python - 如何在 Json Schema 中使用 $ref 的相对路径

json - 验证 Node 中 swagger json.schema 的 POST 数据

c# - Newtonsoft JSON 架构忽略反序列化验证