You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
I am surprised that this is marked for 1B, imho there are other, more real-world use issues that would be better implemented in 1B and leave Hypermedia until 1C
I believe Hypermedia elegantly solves many real-world issues such as client decoupling, versioning (along with content negotiation), discoverability to name a few. It also directly contributes to better API design, maintainability and scalability.
The idea is to bake its support directly into API Blueprint so you do not even have to think whether you are hypermedia or not. For example this could automatically provide the location HTTP header where applicable or construct the link HTTP header etc. In cooperation with #10 this could go even further utilizing media types such as Collection+JSON, Siren or HAL.
Idealistically, should you choose to, I would like you to think about resources, relations and actions not HTTP verbs, URIs and such, but that is definitely even beyond the 1C..
@mikekelly, this is how I project it at this very moment:
In API Blueprint (Markdown), using some semantic assumptions:
Define a resource with a name, id or an URI
Describe the resource model media type (state, attributes)
Describe relations between the model and other resource models
Specify a transaction example with a hypermedia affordance provider media type content negotiation
The API Blueprint parser (or its harness) will take the care of injecting the actual model media type and relations (possibly even actions) into the hypermedia affordance provider media type.
Using part of @lukestokesfoxycart API something along these lines (again, just sketching here):
# Resource User [User]+ Model (application/json)
``` { "first_name": "Qing", "last_name": "woldu", "email": "[email protected]", "phone": "12345678", "affiliate_id": 0, "is_programmer": false, "is_front_end_developer": false, "is_designer": false, "is_merchant": false, "date_created": "2012-02-29T13:55:09-0800", "date_modified": "2013-07-11T15:28:56-0700" } ```+ Relations + self = [User][] ... This User + stores = [Stores][] ... Stores for This User## Retrieve a User [GET]+ Request (Accept: application/json)+ Response 200 (application/json) [User.json][]+ Request (Accept: application/hal+json)+ Response 200 (application/hal+json) [User.hal+json][]# Resource Stores [Stores]+ Model (application/json) ...
The API Blueprint parser would take care of injecting the user application/json model into the respective response media type in its resulting AST (and AST media types) e.g. do just a verbatim copy for [User.json][] or build the application/hal+json representation in the case of [User.hal+json][] using the model and relations.
Note I would also love to have Siren on board alongside with HAL in the first round. Considering other provides later. Also this concept can be extended to auto generate the Link HTTP header.
This is in a nutshell how I think about this issue at the moment. There are still few pieces of puzzle missing but that is alright for now. Please let me know what you do think and whether it can work at all.
Thank you!
Note for @kevinswiber : This is the topic we didn't have the chance to discuss at #apicraft.
I'll let smarter people than myself comment on the approach, but let me just say I'm really excited about seeing progress in this direction! Our sandbox supports both HAL and Siren, so I hope it can be a useful "real world" test bed for trying some of this stuff out. If I can help in a specific way, please let me know. Here are some of the keys I can think of as it relates to the needs client developer:
Educate and enforce the importance of REST principles (think in terms of media types, response codes, caching concerns, resources, link relationships, etc and less in terms of remote procedure calls to URLs).
Use visualizations in the documentation that help them navigate relationships to find the resources of the API they are interested in. As a real world example, we have users who only want to integrate with the API so they can generate and manipulate coupons. Building a documentation interface that helps them navigate to that relationship will be great.
One thing I was also considering is that not every API has to (or will be) a true REST API. If there's a clear way to distinguish between JSON RPC APIs and REST Hypermedia APIs, that would be fantastic.
Great work, Z. I'm really looking forward to where this goes.
@lukestokes I do agree in all points but the very first one – you are very qualified, if not the best, for commenting on this issue!
Regarding the clients – as we have discussed with @cainus its the clients where we need to improve the situation next. Not by telling them what they should do but pointing real life benefits as well as offer the best tools to consume our APIs. Now imaging sticking an hypermedia-enabled API Blueprint into a client SDK to configure it for your API and provide realtime request checks etc... (OK now I am totally going both off topic & off the roof :)
I think the only reasonable way of achieving broader adoption is to ship APIs where clients will code against them without even knowing what hypermedia is. This means we need media types that people can treat as plain JSON and they are still just as easy to work with and understand.
If I was you, I would pick the media types you initially adopt here carefully. If you offer something that is too complicated, and not intuitive enough - you are going to undermine your larger objective.
ship APIs where clients will code against them without even knowing what hypermedia is
However I do believe a broader adoption would be achieved through providing API SDKs and/or tighter framework client integration rather than finding the "holy grail" of media types. I treat a media type just as a mean to transfer the resource representation and, in some cases, hyperlink relations. Idealistically a client should be interested in (and exposed only to) actual resource data and the relations, not in the technical means of the communication itself.
In another words as a client you should only need to know your data are and where to get the next.
This is exactly what I would like to achieve with API Blueprint. In the first step to sweep the technical means of a hypermedia API under a nice and tidy Markdown carpet, so you do not have to really think HAL, Siren or anything like this – you just focus on your data and relations. Second do the same on the consumer's end – using an API Blueprint on client to hide the HTTP / transfer technicalities and provide directly the data and relations.
It's funny, prior to the RESTfest talk by @bsletten , I would have been worried about hiding things behind an SDK or client library. But now, if REST is truly used under the hood, I can see that the format and the datastore don't matter as much, as long as information can be treated as addressable resources which tell you what can be done next. His keynote video isn't up on vimeo yet, or I'd link to it.
However I do believe a broader adoption would be achieved through providing API SDKs and/or tighter framework client integration rather than finding the "holy grail" of media types. I treat a media type just as a mean to transfer the resource representation and, in some cases, hyperlink relations. Idealistically a client should be interested in (and exposed only to) actual resource data and the relations, not in the technical means of the communication itself.
👍
We care more about the media types, because that's what we do. Most people just want to get the job done.
The difficult thing when supporting multiple hypermedia types on the same server is transforming capabilities between media types. If one media type only supports links while another supports controls, do you whittle down to the least common denominator? If so, why have additional media types? Do you provide enough information for capabilities of ALL media types supported? If so, do you just discard that information when rendering media types that don't support it?
These aren't very easy problems to solve in some cases. I'm curious what route @lukestokes took with FoxyCart.
Note for @kevinswiber : This is the topic we didn't have the chance to discuss at #apicraft.
Hey @zdne, sorry we didn't get a chance to discuss.
Here's how I've been looking at Siren APIs, in terms of documentation.
Things to define:
Classes
Link relations (for entities and links)
Actions
Entities of a particular class may have certain properties, sub-entities, actions, and links. (Note: An entity can have multiple classes.) Defining this is important in documentation. I use class values to route responses to appropriate handlers on the client side. This allows the client to respond to the actual message from the server instead of setting an expectation at request time. For some, this is a different way of thinking, but it's an extremely powerful, reactive pattern.
Everything flows from the entity class documentation. Sub-entities have link relations that should be defined. Actions should be defined, and so should expected input fields. Hidden input fields, of course, should not be defined. The Siren spec instructs clients to resubmit hidden fields.
As far as functional documentation (docs that are able to submit requests), with Siren, this has to be dynamic. One of Siren's benefits is communicating available actions at request-time, based on resource state. Potential state transitions can change, and so, too, should the active docs.
These aren't very easy problems to solve in some cases. I'm curious what route @lukestokes took with FoxyCart.
We are just at the lowest common denominator right now. I wanted to include actions in our Siren support (and still plan to in the future), but we didn't want to go there until we finalized more important link relationships and property naming conventions.
I also want to support Collection, though I'd probably have to do an extension of it because we want to include properties of the collection such as total_items, returned_items, limit, and offset. In the future I may look into XHTML as well.
The formatting of the output, imo, isn't nearly as hard as properly designing the API in the first place. As long as the API has a good format layer in place, it's just a matter of moving data around. We did run into some funkiness with how things are done in JSON vs. XML, but for the most part, I think we came up with good approaches that wouldn't appear as compromises. Our hope in supporting multiple formats is that we can be a "real world" API for people to start testing their hypermedia tools against. More tools = more adoption.
Any way, as it relates to this discussion, maybe it would make sense to include @mamundH-Factor ideas when thinking about the documentation system. Just a thought.
I'm just dipping my toes into this hypermedia ocean. The featured apiary apis look great, hadn't discovered it until recently! Apiary looks really powerful! @lukestokes the foxy cart api looks like it already supports hypermedia and consequently serendipitous api navigation discovery!
Anywho, as a background, I've been trying to socialize RESTful services and take it to the next level (of maturity) @ The Container Store. As a start, we've been using swagger to "document" our internal API's. Thats a great start, and it seems like a very similar approach to apiary. I've been thinking about how to make the simple API's hypermedia aware, and secondly how to make them discoverable once it is. Like @mikekelly said,
I think the only reasonable way of achieving broader adoption is to ship APIs where clients will code against them without even knowing what hypermedia is.
My 2 cents; considerations when it comes to hyper media, documentation and restful services
The generation of the documentation cannot be deliberate, as in, distinct from the act of designing the API/service itself. So either the service can allow the generation of service information or vice versa. That way each side does not have the risk of being out of date. So the workflow is really important for adoption.
Secondly, the whole notion of "documentation" falls flat with respect to a hypermedia API. By definition for a hypermedia API you should only need to document the entry points (as proposed by @zdne) the rest should be inferred as a result of navigation and discovery. Otherwise, IMHO it smells of the RPC style documentation that we got with SOAP, WSDL and its band of brothers.
We care more about the media types, because that's what we do. Most people just want to get the job done.
I'm in the latter camp for sure. Hal happened because I wrote a gist to show what I was building, then bunch of other people got interested so made a little website, then people started asking for a spec...
I don't care that much about media types - I care about helping people build effective, usable APIs.
There are some media types which I, as someone who's been around this space for a bit, feel are basically over-complicated and solving problems nobody's even sure they have - which is fine in and of itself, but when it comes to projects like this is worth highlighting as a risk for the reason you've outlined here:
The difficult thing when supporting multiple hypermedia types on the same server is transforming capabilities between media types. If one media type only supports links while another supports controls, do you whittle down to the least common denominator? If so, why have additional media types? Do you provide enough information for capabilities of ALL media types supported? If so, do you just discard that information when rendering media types that don't support it?
Don't get me wrong, I think pushing things further is worthwhile, but I think picking the low-hanging fruit first and then figuring out where to go next is a more reasonable approach. It sounds like this is exactly what @lukestokes has done with the foxycart API - I'll be interested to see where they go next.
I care about helping people build effective, usable APIs.
Excellent point Mike! This is my aspiration with API Blueprint.
Again looking at FoxyCart HAL Browser: Basically my idea is to describe what is in the left pane in a Markdown syntax and let API Blueprint parser generate what is on the right. Without any prior knowledge of HAL or HTTP / REST.
Just tell me about your data and the relations. Simple.
I'm totally late to the party, but thank you for the rich discussions so far. Definitely mirrors discussions happening as part of our struggles to define APIs internally, as part of improving both client-side and server-side developer experiences....
Just reviewing the Resource Blueprint. I think it's a step in the right direction, which I haven't seen any other similar initiatives take yet. One thing that I'm either confused or concerned (confuscerned ?) about:
Includes transitions in different states (business rules) and the conditions (permissions) for their inclusion in a response.
Transition to different states - from the client side this makes sense. Here are the different actions you can possibly undertake, and should look out for as part of a response. The conditions to me are part of the underlying business logic, which I’m trying to shield the client from with an API. Why this affordance appears in the response shouldn’t be a client side concern. From a server-side perspective, the conditions can and should evolve as my system grows, and I should be free to do so without revisiting my resource definition, as I don't think it breaks my client-side contract.
From a practical point of view:
I have a shopping cart
I have a checkout affordance, which appears if I fill out all my cart information as part of state transitions
As a system, I need to add in a new condition which hides the checkout action if terms and conditions have not been agreed to by a given state transition. Is this something I need to document here as a condition? It’s logic behind the API, which may not even be a system I control.
@drewzboto If you look at the use of Conditions in say the create transition in the sample API, you will see it is not an affordance. Rather, as part of the API design process, you need to ask questions about conditions for inclusion.
Whether it is business logic (does the transition even exist) or permissions (the transition is available in the context of the user, role, etc) is all transparent to the client and is encapsulated in the API implementation as you note. Not everything in the blueprint will roll over to the human readable documentation generated by it. It is a good question whether conditions should. Presumably somewhere if there are permissions that should be set up, you would want to document their applicability. Not sure that would be via Conditions.
Given the blueprint is itself a design tool, thinking about permissions separate from the existence of a transition in a state is a useful abstraction, and thus the point of its inclusion. @zdne may have other thoughts.
No, I would say the party is just about to start – we are only at the dawn of the "API design" age.
Is this something I need to document ...
No. The resource blueprint is a permissive language. The minimum reasonable blueprint would include just a resource with one attribute, perhaps one affordance (other than "self").
Documenting conditions clearly depends on the API designer. Should I document a condition that controls whether I can "create" a resource? Probably yes. Should I document a condition that controls whether I can perform a "checkout"? I would say no if it is obvious (e.g. cart is empty clearly implies checkout does not make sense). But again it is up to the designer(s) to decide. The option is here.
As for rendered documentation – it is a good question whether and how it should capture the conditions. My feeling is it should. Important thing here is that the blueprint shouldn't be written in the respect "how rendered documentation looks" but with the focus on the particular API design and the use of blueprint in the API lifecycle process. Rendered documentation is just a tool using it, and there are hopefully many, not just the one from Apiary.
@stefanpearson Yes, we are making quite a progress towards Resource Blueprint with the MSON.
MSON is the building stone for Resource Blueprint as it will enables the description of Resource attributes (semantic descriptors) and also of the affordances.
Well I haven't implemented it yet, but my end-goal at the moment is to:
Have a clean model for each resource (not including the hypermedia)
Have a schema for each model (not including the hypermedia)
Set up link relationships and embed records (embeds can also have nested links and embeds). These references will pull in the respective resource model and schema, to create the actual representation of a payload.
It's worth noting that I'm also using the resource/action schemas (JSON schema) to validate incoming request bodies, and validate outgoing response bodies within my tests. In lieu of this, the JSON schema output needs to actually include and represent the relevant hypermedia.
At the moment, as a workaround, my immediate thought is to:
define relationships (probably outside of the blueprint)
parse the blueprint to get the JSON representation
use a templating engine to inject the embeds/links (thus creating a valid 1A blueprint, albeit with buckets of repetition)
Activity
rurounijones commentedon Aug 14, 2013
I am surprised that this is marked for 1B, imho there are other, more real-world use issues that would be better implemented in 1B and leave Hypermedia until 1C
zdne commentedon Aug 14, 2013
I believe Hypermedia elegantly solves many real-world issues such as client decoupling, versioning (along with content negotiation), discoverability to name a few. It also directly contributes to better API design, maintainability and scalability.
The idea is to bake its support directly into API Blueprint so you do not even have to think whether you are hypermedia or not. For example this could automatically provide the location HTTP header where applicable or construct the link HTTP header etc. In cooperation with #10 this could go even further utilizing media types such as Collection+JSON, Siren or HAL.
Idealistically, should you choose to, I would like you to think about resources, relations and actions not HTTP verbs, URIs and such, but that is definitely even beyond the 1C..
mikekelly commentedon Sep 25, 2013
Has anyone sketched out what this might look like?
zdne commentedon Sep 25, 2013
@mikekelly, this is how I project it at this very moment:
In API Blueprint (Markdown), using some semantic assumptions:
The API Blueprint parser (or its harness) will take the care of injecting the actual model media type and relations (possibly even actions) into the hypermedia affordance provider media type.
Using part of @lukestokes foxycart API something along these lines (again, just sketching here):
The API Blueprint parser would take care of injecting the user
application/jsonmodel into the respective response media type in its resulting AST (and AST media types) e.g. do just a verbatim copy for[User.json][]or build theapplication/hal+jsonrepresentation in the case of[User.hal+json][]using the model and relations.Note I would also love to have Siren on board alongside with HAL in the first round. Considering other provides later. Also this concept can be extended to auto generate the Link HTTP header.
This is in a nutshell how I think about this issue at the moment. There are still few pieces of puzzle missing but that is alright for now. Please let me know what you do think and whether it can work at all.
Thank you!
Note for @kevinswiber : This is the topic we didn't have the chance to discuss at #apicraft.
lukestokes commentedon Sep 25, 2013
I'll let smarter people than myself comment on the approach, but let me just say I'm really excited about seeing progress in this direction! Our sandbox supports both HAL and Siren, so I hope it can be a useful "real world" test bed for trying some of this stuff out. If I can help in a specific way, please let me know. Here are some of the keys I can think of as it relates to the needs client developer:
One thing I was also considering is that not every API has to (or will be) a true REST API. If there's a clear way to distinguish between JSON RPC APIs and REST Hypermedia APIs, that would be fantastic.
Great work, Z. I'm really looking forward to where this goes.
zdne commentedon Sep 25, 2013
@lukestokes I do agree in all points but the very first one – you are very qualified, if not the best, for commenting on this issue!
Regarding the clients – as we have discussed with @cainus its the clients where we need to improve the situation next. Not by telling them what they should do but pointing real life benefits as well as offer the best tools to consume our APIs. Now imaging sticking an hypermedia-enabled API Blueprint into a client SDK to configure it for your API and provide realtime request checks etc... (OK now I am totally going both off topic & off the roof :)
mikekelly commentedon Sep 25, 2013
I think the only reasonable way of achieving broader adoption is to ship APIs where clients will code against them without even knowing what hypermedia is. This means we need media types that people can treat as plain JSON and they are still just as easy to work with and understand.
If I was you, I would pick the media types you initially adopt here carefully. If you offer something that is too complicated, and not intuitive enough - you are going to undermine your larger objective.
But I would say that, obviously.
zdne commentedon Sep 25, 2013
Mike, while I do agree with this line:
However I do believe a broader adoption would be achieved through providing API SDKs and/or tighter framework client integration rather than finding the "holy grail" of media types. I treat a media type just as a mean to transfer the resource representation and, in some cases, hyperlink relations. Idealistically a client should be interested in (and exposed only to) actual resource data and the relations, not in the technical means of the communication itself.
In another words as a client you should only need to know your data are and where to get the next.
This is exactly what I would like to achieve with API Blueprint. In the first step to sweep the technical means of a hypermedia API under a nice and tidy Markdown carpet, so you do not have to really think HAL, Siren or anything like this – you just focus on your data and relations. Second do the same on the consumer's end – using an API Blueprint on client to hide the HTTP / transfer technicalities and provide directly the data and relations.
What do you think?
lukestokes commentedon Sep 25, 2013
It's funny, prior to the RESTfest talk by @bsletten , I would have been worried about hiding things behind an SDK or client library. But now, if REST is truly used under the hood, I can see that the format and the datastore don't matter as much, as long as information can be treated as addressable resources which tell you what can be done next. His keynote video isn't up on vimeo yet, or I'd link to it.
kevinswiber commentedon Sep 25, 2013
@zdne
👍
We care more about the media types, because that's what we do. Most people just want to get the job done.
The difficult thing when supporting multiple hypermedia types on the same server is transforming capabilities between media types. If one media type only supports links while another supports controls, do you whittle down to the least common denominator? If so, why have additional media types? Do you provide enough information for capabilities of ALL media types supported? If so, do you just discard that information when rendering media types that don't support it?
These aren't very easy problems to solve in some cases. I'm curious what route @lukestokes took with FoxyCart.
kevinswiber commentedon Sep 25, 2013
Hey @zdne, sorry we didn't get a chance to discuss.
Here's how I've been looking at Siren APIs, in terms of documentation.
Things to define:
Entities of a particular class may have certain properties, sub-entities, actions, and links. (Note: An entity can have multiple classes.) Defining this is important in documentation. I use class values to route responses to appropriate handlers on the client side. This allows the client to respond to the actual message from the server instead of setting an expectation at request time. For some, this is a different way of thinking, but it's an extremely powerful, reactive pattern.
Everything flows from the entity class documentation. Sub-entities have link relations that should be defined. Actions should be defined, and so should expected input fields. Hidden input fields, of course, should not be defined. The Siren spec instructs clients to resubmit hidden fields.
As far as functional documentation (docs that are able to submit requests), with Siren, this has to be dynamic. One of Siren's benefits is communicating available actions at request-time, based on resource state. Potential state transitions can change, and so, too, should the active docs.
lukestokes commentedon Sep 25, 2013
We are just at the lowest common denominator right now. I wanted to include actions in our Siren support (and still plan to in the future), but we didn't want to go there until we finalized more important link relationships and property naming conventions.
I also want to support Collection, though I'd probably have to do an extension of it because we want to include properties of the collection such as total_items, returned_items, limit, and offset. In the future I may look into XHTML as well.
The formatting of the output, imo, isn't nearly as hard as properly designing the API in the first place. As long as the API has a good format layer in place, it's just a matter of moving data around. We did run into some funkiness with how things are done in JSON vs. XML, but for the most part, I think we came up with good approaches that wouldn't appear as compromises. Our hope in supporting multiple formats is that we can be a "real world" API for people to start testing their hypermedia tools against. More tools = more adoption.
Feel free to play around with it. I'd love any feedback you have: https://api.foxycart.com/docs
Any way, as it relates to this discussion, maybe it would make sense to include @mamund H-Factor ideas when thinking about the documentation system. Just a thought.
dilipkrish commentedon Sep 26, 2013
I'm just dipping my toes into this hypermedia ocean. The featured apiary apis look great, hadn't discovered it until recently! Apiary looks really powerful! @lukestokes the foxy cart api looks like it already supports hypermedia and consequently serendipitous api navigation discovery!
Anywho, as a background, I've been trying to socialize RESTful services and take it to the next level (of maturity) @ The Container Store. As a start, we've been using swagger to "document" our internal API's. Thats a great start, and it seems like a very similar approach to apiary. I've been thinking about how to make the simple API's hypermedia aware, and secondly how to make them discoverable once it is. Like @mikekelly said,
My 2 cents; considerations when it comes to hyper media, documentation and restful services
Glad to help take this discussion forward.
mikekelly commentedon Sep 26, 2013
@kevinswiber
I'm in the latter camp for sure. Hal happened because I wrote a gist to show what I was building, then bunch of other people got interested so made a little website, then people started asking for a spec...
I don't care that much about media types - I care about helping people build effective, usable APIs.
There are some media types which I, as someone who's been around this space for a bit, feel are basically over-complicated and solving problems nobody's even sure they have - which is fine in and of itself, but when it comes to projects like this is worth highlighting as a risk for the reason you've outlined here:
Don't get me wrong, I think pushing things further is worthwhile, but I think picking the low-hanging fruit first and then figuring out where to go next is a more reasonable approach. It sounds like this is exactly what @lukestokes has done with the foxycart API - I'll be interested to see where they go next.
zdne commentedon Sep 26, 2013
@mikekelly
Excellent point Mike! This is my aspiration with API Blueprint.
Again looking at FoxyCart HAL Browser: Basically my idea is to describe what is in the left pane in a Markdown syntax and let API Blueprint parser generate what is on the right. Without any prior knowledge of HAL or HTTP / REST.
Just tell me about your data and the relations. Simple.
93 remaining items
drewzboto commentedon Feb 18, 2014
I'm totally late to the party, but thank you for the rich discussions so far. Definitely mirrors discussions happening as part of our struggles to define APIs internally, as part of improving both client-side and server-side developer experiences....
Just reviewing the Resource Blueprint. I think it's a step in the right direction, which I haven't seen any other similar initiatives take yet. One thing that I'm either confused or concerned (confuscerned ?) about:
Transition to different states - from the client side this makes sense. Here are the different actions you can possibly undertake, and should look out for as part of a response. The conditions to me are part of the underlying business logic, which I’m trying to shield the client from with an API. Why this affordance appears in the response shouldn’t be a client side concern. From a server-side perspective, the conditions can and should evolve as my system grows, and I should be free to do so without revisiting my resource definition, as I don't think it breaks my client-side contract.
From a practical point of view:
fosdev commentedon Feb 18, 2014
@drewzboto If you look at the use of
Conditionsin say thecreatetransition in the sample API, you will see it is not an affordance. Rather, as part of the API design process, you need to ask questions about conditions for inclusion.Whether it is business logic (does the transition even exist) or permissions (the transition is available in the context of the user, role, etc) is all transparent to the client and is encapsulated in the API implementation as you note. Not everything in the blueprint will roll over to the human readable documentation generated by it. It is a good question whether conditions should. Presumably somewhere if there are permissions that should be set up, you would want to document their applicability. Not sure that would be via
Conditions.Given the blueprint is itself a design tool, thinking about permissions separate from the existence of a transition in a state is a useful abstraction, and thus the point of its inclusion. @zdne may have other thoughts.
zdne commentedon Feb 19, 2014
@drewzboto
No, I would say the party is just about to start – we are only at the dawn of the "API design" age.
No. The resource blueprint is a permissive language. The minimum reasonable blueprint would include just a resource with one attribute, perhaps one affordance (other than "self").
Documenting conditions clearly depends on the API designer. Should I document a condition that controls whether I can "create" a resource? Probably yes. Should I document a condition that controls whether I can perform a "checkout"? I would say no if it is obvious (e.g. cart is empty clearly implies checkout does not make sense). But again it is up to the designer(s) to decide. The option is here.
As for rendered documentation – it is a good question whether and how it should capture the conditions. My feeling is it should. Important thing here is that the blueprint shouldn't be written in the respect "how rendered documentation looks" but with the focus on the particular API design and the use of blueprint in the API lifecycle process. Rendered documentation is just a tool using it, and there are hopefully many, not just the one from Apiary.
Enable experiment #13
stefanpearson commentedon Oct 29, 2014
Are there any updates to this? Would be great to see a more efficient way of using hypermedia links/embeds in blueprint soon!
zdne commentedon Oct 29, 2014
@stefanpearson Yes, we are making quite a progress towards Resource Blueprint with the MSON.
MSON is the building stone for Resource Blueprint as it will enables the description of Resource attributes (semantic descriptors) and also of the affordances.
I also plan to update Resource Blueprint concept soon. I will keep you posted in this thread.
stefanpearson commentedon Oct 29, 2014
That's good news :), I'm having to do some very questionable pre-processing to get around this!
zdne commentedon Oct 29, 2014
@stefanpearson can you share more details on this? perhaps there is something we can learn from it
stefanpearson commentedon Oct 29, 2014
Well I haven't implemented it yet, but my end-goal at the moment is to:
It's worth noting that I'm also using the resource/action schemas (JSON schema) to validate incoming request bodies, and validate outgoing response bodies within my tests. In lieu of this, the JSON schema output needs to actually include and represent the relevant hypermedia.
At the moment, as a workaround, my immediate thought is to:
fix states as noted in apiaryio/api-blueprint#13 (comment)