API Blueprint AST Source Map
March 30, 2015 ยท View on GitHub

API Blueprint AST Source Map
This document defines API Blueprint AST Source Map. API Blueprint Source Map is 1-on-1 with API Blueprint AST and represents the source maps for each of the nodes in the AST tree.
Version
Refer to the API Blueprint AST Definition โ the version of the Source Map always conforms to the version of API Blueprint AST.
Quick Links
Source Map Definition
Following is the definition of Source map media types using the MSON syntax.
Source Map (array)
Set of indices to source code blocks. The blocks may be non-continuous.
Each block is defined by a zero-based index of its first character and the number of following characters.
Items
- (array, fixed) - A tuple defining position of a block in the source code
- 1219 (number) - Zero-based index of the first character
- 30 (number) - Number of the characters in the block
Blueprint Source Map (object)
Source map of the Blueprint.
Properties
metadata(array[Source Map]) - An array of source maps where each item in metadata has its own source mapname(Source Map) - Source map of API namedescription(Source Map) - Source map of API descriptionresourceGroups(array[Resource Group Source Map]) - Deprecatedcontent(array[Element Source Map]) - Source map of section elements
Element Source Map (object)
attributesname(Source Map) - Source map of the element name
content(enum)- (array[Element Source Map]) - Source maps of nested elements (for element
category) - (Source Map) - Source map (for element
copyandasset) - (Resource Source Map) - Source map of Resource (for element
resource) - (Data Structure Source Map) - Source map of Data Structure (for element
dataStructure)
- (array[Element Source Map]) - Source maps of nested elements (for element
Resource Group Source Map (object)
Deprecated
Source map of the Resource Group.
Properties
name(Source Map) - Source map of name of the Resource Groupdescription(Source Map) - Source map of description of the Resource Groupresources(array[Resource Source Map]) - Ordered array of the respective resources belonging to the Resource Group
Resource Source Map (object)
Source map of the Resource.
Properties
name(Source Map) - Source map of name of the Resourcedescription(Source Map) - Source map of description of the ResourceuriTemplate(Source Map) - Source map of URI Templatemodel(Payload Source map) - Resource Model, a reusable payload representing the resourceparameters(array[Parameter Source Map]) - Ordered array of source maps of URI parametersactions(array[Action Source Map]) - Ordered array of source maps of actions available on the resource each defining at least one complete HTTP transactioncontent(array[Data Structure Source Map]) - Ordered array of Resource source map's elements
Action Source Map (object)
Source map of the Action.
Properties
name(Source Map) - Source map of name of the Actiondescription(Source Map) - Source map of description of the Actionmethod(Source Map) - Source map of HTTP request method defining the actionparameters(array[Parameter Source Map]) - Ordered array of source maps of resource's URI parameters descriptions specific to this actionexamples(array[Transaction Example Source Map]) - Ordered array of source maps of HTTP transaction examples for the relevant HTTP request methodattributes(object)uriTemplate(string) - Source map of URI Templaterelation(string) - Source map of link relation identifier of the action
content(array[Data Structure Source Map]) - Ordered array of Action source map's elements
Payload Source Map (object)
Source map of Payload.
When a reference is used, the source map of the payload is in fact the source map of the Resource Model.
Properties
-
name(Source Map) - Source map of name of the payload -
reference(Source Map) - Source map of the reference, present if and only if a reference to a Resource Model is present in the payload and it has been resolved correctly -
description(Source Map) - Source map of description of the payload -
attributes([Attributes Source Map][]) - Source map of attributes of the Payload -
headers(array[Source Map]) - Ordered array of source maps of HTTP headers that are expected to be transferred with HTTP message represented by this payload. Each item in the header has it's own source map. -
body(Source Map) - DeprecatedSource map of body to be transferred with HTTP message represented by this payload
Note this property is deprecated and will be removed in a future. Use
assets/body/sourceinstead. -
schema(Source Map) - DeprecatedSource map of a validation schema for the entity body as defined in
body.Note this property is deprecated and will be removed in a future. Use
assets/schema/sourceinstead. -
content(array) - Ordered array of Payload source map's elements- Items
Asset Source Map (Element Source Map)
Source map of Asset
Parameter Source Map (object)
Source map of Parameter.
Properties
description(Source Map) - Source map of description of the parametertype(Source Map) - Source map of an arbitrary type of the parameter (a string)required(Source Map) - Source map of boolean flag denoting whether the parameter is required (true) or not (false)default(Source Map) - Source map of a default value of the parameter (a value assumed when the parameter is not specified)example(Source Map) - Source map of an example value of the parametervalues(array[Source Map]) - Source map of an array enumerating possible parameter values. Each item has it's own source map.
Transaction Example Source Map (object)
Source map of Transaction Example.
Properties
name(Source Map) - Source map of name of the Transaction Exampledescription(Source Map) - Source map of description of the Transaction Examplerequests(array[Payload Source Map]) - Ordered array of source maps of example transaction request payloadsresponses(array[Payload Source Map]) - Ordered array of source maps of example transaction response payloads
Data Structure Source Map (Named Type Source Map)
Source map of Data Structure
Media Types
The application/vnd.apiblueprint.sourcemap is the base media type for API Blueprint AST Source Map.
Serialization formats
Two supported, feature-equal serialization formats are JSON and YAML:
application/vnd.apiblueprint.sourcemap+jsonapplication/vnd.apiblueprint.sourcemap+yaml