Skip to content

JsonLD types #672

@chriskapp

Description

@chriskapp

Through the TypeHub platform we automatically get JsonLD types, we should think about adding a @type property to every backend JSON response so that we also describe the JSON payload. A collection response would then look like s.

{
    "@type": "https://typehub.cloud/s/fusio/sdk/7.0.7/Backend_ActionCollection",
    "totalResults": 2,
    "startIndex": 0,
    "itemsPerPage": 16,
    "entry": [
        {
            "@type": "https://typehub.cloud/s/fusio/sdk/7.0.7/Backend_Action",
            "id": 3,
            "status": 1,
            "name": "Sql-Insert",
            "class": "Fusio.Adapter.Sql.Action.SqlInsert",
            "date": "[datetime]"
        },
        {
            "@type": "https://typehub.cloud/s/fusio/sdk/7.0.7/Backend_Action",
            "id": 2,
            "status": 1,
            "name": "Sql-Select-All",
            "class": "Fusio.Adapter.Sql.Action.SqlSelectAll",
            "date": "[datetime]"
        }
    ]
}

and the entity response s.

{
    "@type": "https://typehub.cloud/s/fusio/sdk/7.0.7/Backend_Action",
    "id": 3,
    "status": 1,
    "name": "Sql-Insert",
    "class": "Fusio.Adapter.Sql.Action.SqlInsert",
    "async": false,
    "config": {
        "connection": 2,
        "table": "app_news"
    },
    "date": "[datetime]"
}

In general this is great since this would make all responses JSON-LD compatible but we have only one problem regarding the automatically generated client SDK. If we include this in the schema the @type could make a problem since in most programming languages we can not use @ as variable name, thus the generator would normalize this to i.e. _ which will look strange at the client SDK. As alternative we could also ignore the @type property from the schema and only add this to the response.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions