apiblueprint

How to format hash-based parameters in the URL when creating Blueprint API doc?

青春壹個敷衍的年華 提交于 2020-01-14 06:21:07
问题 With the Rails Way of adding hashes in the parameter of an URL like so: http://api.example.com?person[first]=Jane&person[last]=Doe&person[email]=jane@doe.com How do I format the API Blueprint doc to accommodate a list of available hashes? Parameters person[first] (required, string, Jane ) ... First name This is not legal when I execute the document. Any ideas or tips are welcome! 回答1: Per https://tools.ietf.org/html/rfc3986#section-3.2.2, you must escape [] in URIs. As such, you need to do:

Represent File Uploads in API Blueprints

喜你入骨 提交于 2020-01-04 03:53:13
问题 We have an API end point where an image file can be uploaded along with the name of the file (a string) as well as a description (string). Apiary / API Blueprints won't allow me to have something like: + Request (multipart/form-data) + Headers Authorization: [key] + Attributes + name (string, required) - A human-readable name of the Catalog Item + description (string, optional) - A human readable description of the Catalog Item + image (file, optional) - An image file corresponding to the

Apiary: Export API as JSON, to generate client code

拜拜、爱过 提交于 2020-01-03 09:12:22
问题 We all know that apiary rocks (or not.. I think it does), and I was wondering what would it take to take it a step further allow users to export a JSON description of the API? (So developers can script client code generation) This should help: http://ttezel.github.io/blog/2013/02/23/stop-writing-rest-api-clients/ 回答1: There are two directions you can explore: you can use Alpaca to generate client SDKs. Alpaca accepts API Blueprint as one of it's input formats for more flexibility, you can use

Sails 1.0 cannot access autogenerated associated entity routes

孤者浪人 提交于 2019-12-25 00:54:33
问题 I have an association between Client and Budget as follows: //Client.js module.exports = { primaryKey: 'id', attributes: { id: { type: 'number', unique: true, autoIncrement: true }, name: { type: 'string' }, phone: { type: 'string', unique: true }, email: { type: 'string', unique: true }, budgets: { collection: 'budget', via: 'client' }, } }; // Budget.js module.exports = { primaryKey: 'id', attributes: { id: { type: 'number', unique: true, autoIncrement: true }, client: { model: 'client' },

MSON to describe object attributes in blueprint

女生的网名这么多〃 提交于 2019-12-23 02:31:20
问题 I have an issue similar to what is described here. I have a JSON that looks like this: { "photos": [ { "key": "y37dmj10jkwof/moOIUB8912JKVgh", "caption": "A world of gamers.", "tags": [ "game", "japan" ], "attributes": { "copyright": true, "use": [ "public", "private" ] } } ] } and I am trying to describe the attributes using MSON, to render the blueprint. However, I am not successful at it. Here is my attempt: + Attributes (required, object) + photos (required, array) + (object) + key

How to specify an optional element for a json request object

心不动则不痛 提交于 2019-12-21 11:54:52
问题 In API blueprint I am looking to specify an optional json element for a POST message. Example for; ### Add a new User [POST] To add a User send a JSON ..... + Request (application/json) { "name": "A name", "age": 30 } How do I indicate to reader of API that age is optional in API call but still show that it's an integer? ~Colin 回答1: Currently there is no dedicated support for doing this. However there are few ways how to achieve this. My preferable is to discuss it in the request description

Apiary: Is it possible to document what JSON response fields are?

我的梦境 提交于 2019-12-21 04:21:27
问题 I would like to document what the actual JSON fields themselves represent. I have documented the GET statement, and parameters but this does not make a complete documentation to give to users. So, in the example below how would I add a comment about "OtherFields". Is this supported? Or do I need to make a companion document somewhere else. ## View Applications [/cat{?sort}{&order}{&page}] ### List all Applications ### Get List of Applications [GET] + Parameters + sort (optional, string) ...

How to extend rather than replace parent Parameters?

十年热恋 提交于 2019-12-11 07:34:53
问题 I've got a resource with multiple parameters, and a single action with one extra. How can I write this with the minimal repeats? Something like this, but that actually works: ## Items [/item{?type}] + Parameters + type (enum[string], optional) + Default: foo + Members + foo + bar ### List [GET {&from}] + Parameters + page (integer, optional) + Default: 1 All other actions should list type , while the GET should list both type and page . 来源: https://stackoverflow.com/questions/41960087/how-to

Repeating a MSON data structure with different values

☆樱花仙子☆ 提交于 2019-12-10 11:44:06
问题 I have many places in my API where I will need to describe a list of objects. Each object has the same keys / structure but different values. How can I tweak the values of each instance of some data structure while retaining all the original type, description, etc of the original structure? for example if I had the following data structure Restaurant # Data Structures ## Restaurant (object) + restaurant_name: McDonald's (string, required) - The name of this restaurant + years_of_operation: 54

Is it possible to center tables in a markdown file?

做~自己de王妃 提交于 2019-12-09 02:13:45
问题 I have a table: | This | Is | A | Table | | :--- | -- | - | ----: | | foo | ba | r | elbaT | I'd like the table to display in the center of my Markdown file instead of left-aligned. I am not trying to align text, but the entire table itself. Do I need to resort to HTML/CSS to achieve what I want? This is for an Apiary.io project. 回答1: If you use the standard documentation, use the <center> tag like so. Blueprint FORMAT: 1A HOST: http://www.google.com # Tables Notes API is a *short texts