resgateio / resgate

A Realtime API Gateway used with NATS to build REST, real time, and RPC APIs, where all your clients are synchronized seamlessly.
https://resgate.io
MIT License
689 stars 67 forks source link

Static resource type #163

Closed jirenius closed 3 years ago

jirenius commented 4 years ago

Issue

A static resource type should be added that allows arbitrary structures of JSON to be passed to the client.

The type will have no events describing mutations. It can be used for data which does not change, or data which the client should not be notified of changes.

Implementation

Service get response

The response to a get request follows the same pattern as for model resources, but with the parameter key "static".

It may look like this:

{
    "result": {
        "static": { "foo": { "bar": [ null ] }, "int": 42 }
    }
}

Client get response

The response follows the same pattern, but the resource set will have an additional optional field, "statics":

{
    "result": {
        "statics": {
            "example.static": { "foo": { "bar": [ null ] }, "int": 42 }
        }
    }
}

Notes

jirenius commented 4 years ago

Resolved in #164

jirenius commented 4 years ago

Reopen after reverting the merge.

The revert was made as the feature added too much complexity to the protocol in comparison to what it solved. A less complex solution that solves the same need for arbitrary data, is tried out in the data value feature.

jirenius commented 3 years ago

Closing as a static resource type will not be the solution for the problem.