Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typed JSON objects #84

Open
lyschoening opened this issue May 28, 2016 · 0 comments
Open

Add typed JSON objects #84

lyschoening opened this issue May 28, 2016 · 0 comments

Comments

@lyschoening
Copy link
Contributor

Routes or complex models sometimes contain field.Object types that would be useful to load into a specific object type on the client side to attach methods or additional meaning to it.

For instance, the client might want to load each location in the following resource into a Location object:

{
    "$uri": "/business/1",
    # ...
    "locations": [
        {
            "street": "Foo st.",
            "city": "Foo City",
            # ...
        },
        # ...
    ]
}

To make this easy to do, there could be a typed object. It would contain a type hint that would help clients add object hooks for that particular type. If a client would not recognize an object, it could simply parse it as regular JSON. The type hints would be an additional property such as "$type": "location". Each type should have its own definition in the schema, but it wouldn't have any links attached to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant