gpt4 book ai didi

java - JSON-LD文档+Hydra Core生成Java代码

转载 作者:行者123 更新时间:2023-11-30 08:17:05 25 4
gpt4 key购买 nike

是否有一个工具可以为 JSON-LD 的 RESTful 服务生成骨架,该服务具有使用 hydra 定义的操作。例如下面的例子,假设我有一个 Java 类 Present Person,构建一个逆向工程 JSON-LD 以生成完整的 spring mvc 代码的工具是一个原始的想法。

{
"@context": [
"http://www.w3.org/ns/hydra/core",
{
"@vocab": "https://schema.org/",
"image": { "@type": "@id" },
"friends": { "@type": "@id" }
}
],
"@id": "https://api.example.com/player/1234567890/friends",
"operation": {
"@type": "BefriendAction",
"method": "POST",
"expects": {
"@id": "http://schema.org/Person",
"supportedProperty": [
{ "property": "name", "range": "Text" },
{ "property": "alternateName", "range": "Text" },
{ "property": "image", "range": "URL" }
]
}
}
}

最佳答案

In fact there is a tool called hydra-java which helps to generate resource representations in the JSON-LD format with hydra-core additions. It also explicitly supports operations.

据我所知,@user3929266 想要从 JSON-LD + Hydra API 文档生成类;不要从 Java 类生成 JSON-LD。如果是这样的话,恐怕目前还没有工具。但是实现一个并将其与 hydra-java 提供的功能结合起来应该相当简单。

关于java - JSON-LD文档+Hydra Core生成Java代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28060102/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com