api-blueprint icon indicating copy to clipboard operation
api-blueprint copied to clipboard

Hypermedia media types

Open zdne opened this issue 9 years ago • 5 comments
trafficstars

Using the information from the Attributes section and the Action section

The API Blueprint parser should be able to render Hypermedia media types on behalf of the user.

For example given following (pseudo) blueprint:

# Resource Blog Post
- attributes
    - content (string)

## Action Retrieve Blog Post
- relation: list (self)
- response 200 (application/hal+json)
    - Attributes (Blog Post)
    - Affordances
        - list
        - edit

## Action Edit Blog Post 
- relation: edit

The response message payload body could be generated as:

{
    "_links": {
        "self": {"href": "..."},
        "edit": {"href": "..."},
    },
    "content": "..."
}

Note this feature can be dramatically improved by implementing the #288 and #290 where the - Affordances could refer to a state (and therefore its collection of affordances):

- Response 200 (application/hal+json)
    - Attributes (Blog Post)
    - Affordances (Archived) 

zdne avatar Dec 10 '15 10:12 zdne

I love this part, Affordances could refer to a state. Simple but powerful.

pksunkara avatar Dec 10 '15 11:12 pksunkara

First of all I would like to see support for application/ld+json.

akuckartz avatar Dec 10 '15 17:12 akuckartz

:+1:

This would be awesome! Just discovered Apiary and loving it so far, but would love to have the JSON API support.

Is there any progress on this? Would love to help out.

jamesdixon avatar Feb 15 '16 02:02 jamesdixon

Hey @jamesdixon it is currently number 8 on the roadmap so no real progress just yet.

I guess next step is to start carving out the RFC for the specification. If you want to play with that and draft a syntax for capturing actions-affordances that would work together with the current actions that would be sweet

zdne avatar Feb 15 '16 12:02 zdne

Thanks, @zdne. I'll see what I can do as I start working with Apiary a bit more -- definitely need more time to familiarize myself with how things work. Cheers.

jamesdixon avatar Feb 15 '16 17:02 jamesdixon