简体   繁体   中英

JSON-LD document + Hydra Core generate Java code

IS there a tool which generates skeleton for a RESTful service for JSON-LD which have operation defined using hydra. For instance take below example, assume I have a Java class present Person, what would be a raw idea to build a tool which reverse engineer JSON-LD to generate a complete spring mvc code.

{
    "@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.

As far as I understood, @user3929266 wants to generate classes from a JSON-LD + Hydra API documentation; not to generate JSON-LD from a Java class. If that's the case, I fear currently there exists no tool. But it should be rather straightforward to implement one and combine it with the features hydra-java offers.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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