コード例 #1
0
// JSONResourceObject creates a single resource object
func JSONResourceObject(name string, attributes *d.UserTypeDefinition, relationships *d.UserTypeDefinition) *d.UserTypeDefinition {
	return a.Type(name, func() {
		a.Attribute("type", d.String, func() {
			a.Enum(strings.ToLower(name) + "s")
		})
		a.Attribute("id", d.String, "ID of the "+name, func() {
			a.Example("42")
		})
		a.Attribute("attributes", attributes)
		if relationships != nil {
			a.Attribute("relationships", relationships)
		}
		a.Required("type", "id", "attributes")
	})
}
コード例 #2
0
})

// workItemLinkCategoryListMeta holds meta information for a work item link category array response
var workItemLinkCategoryListMeta = a.Type("WorkItemLinkCategoryListMeta", func() {
	a.Attribute("totalCount", d.Integer, func() {
		a.Minimum(0)
	})
	a.Required("totalCount")
})

// workItemLinkCategoryData is the JSONAPI store for the data of a work item link category.
var workItemLinkCategoryData = a.Type("WorkItemLinkCategoryData", func() {
	a.Description(`JSONAPI store the data of a work item link category.
See also http://jsonapi.org/format/#document-resource-object`)
	a.Attribute("type", d.String, func() {
		a.Enum("workitemlinkcategories")
	})
	a.Attribute("id", d.String, "ID of work item link category (optional during creation)", func() {
		a.Example("6c5610be-30b2-4880-9fec-81e4f8e4fd76")
	})
	a.Attribute("attributes", workItemLinkCategoryAttributes)
	a.Attribute("links", genericLinks)
	a.Required("type", "attributes")
})

// workItemLinkCategoryAttributes is the JSONAPI store for all the "attributes" of a work item link category.
var workItemLinkCategoryAttributes = a.Type("WorkItemLinkCategoryAttributes", func() {
	a.Description(`JSONAPI store for all the "attributes" of a work item link category.
See also http://jsonapi.org/format/#document-resource-object-attributes`)
	a.Attribute("name", d.String, "Name of the work item link category (required on creation, optional on update)", func() {
		a.Example("system")
コード例 #3
0
ファイル: comments.go プロジェクト: Ritsyy/almighty-core
package design

import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

var comment = a.Type("Comment", func() {
	a.Description(`JSONAPI store for the data of a comment.  See also http://jsonapi.org/format/#document-resource-object`)
	a.Attribute("type", d.String, func() {
		a.Enum("comments")
	})
	a.Attribute("id", d.UUID, "ID of comment", func() {
		a.Example("40bbdd3d-8b5d-4fd6-ac90-7236b669af04")
	})
	a.Attribute("attributes", commentAttributes)
	a.Attribute("relationships", commentRelationships)
	a.Attribute("links", genericLinks)
	a.Required("type")
})

var createComment = a.Type("CreateComment", func() {
	a.Description(`JSONAPI store for the data of a comment.  See also http://jsonapi.org/format/#document-resource-object`)
	a.Attribute("type", d.String, func() {
		a.Enum("comments")
	})
	a.Attribute("attributes", createCommentAttributes)
	a.Required("type", "attributes")
})

var commentAttributes = a.Type("CommentAttributes", func() {
コード例 #4
0
ファイル: iterations.go プロジェクト: Ritsyy/almighty-core
package design

import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

var iteration = a.Type("Iteration", func() {
	a.Description(`JSONAPI store for the data of a iteration.  See also http://jsonapi.org/format/#document-resource-object`)
	a.Attribute("type", d.String, func() {
		a.Enum("iterations")
	})
	a.Attribute("id", d.UUID, "ID of iteration", func() {
		a.Example("40bbdd3d-8b5d-4fd6-ac90-7236b669af04")
	})
	a.Attribute("attributes", iterationAttributes)
	a.Attribute("relationships", iterationRelationships)
	a.Attribute("links", genericLinks)
	a.Required("type", "attributes")
})

var iterationAttributes = a.Type("IterationAttributes", func() {
	a.Description(`JSONAPI store for all the "attributes" of a iteration. +See also see http://jsonapi.org/format/#document-resource-object-attributes`)
	a.Attribute("name", d.String, "The iteration name", func() {
		a.Example("Sprint #24")
	})
	a.Attribute("description", d.String, "Description of the iteration ", func() {
		a.Example("Sprint #42 focusing on UI and build process improvements")
	})
	a.Attribute("startAt", d.DateTime, "When the iteration starts", func() {
		a.Example("2016-11-29T23:18:14Z")
コード例 #5
0
ファイル: areas.go プロジェクト: Ritsyy/almighty-core
package design

import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

var area = a.Type("Area", func() {
	a.Description(`JSONAPI store for the data of a Area.  See also http://jsonapi.org/format/#document-resource-object`)
	a.Attribute("type", d.String, func() {
		a.Enum("areas")
	})
	a.Attribute("id", d.UUID, "ID of area", func() {
		a.Example("40bbdd3d-8b5d-4fd6-ac90-7236b669af04")
	})
	a.Attribute("attributes", areaAttributes)
	a.Attribute("relationships", areaRelationships)
	a.Attribute("links", genericLinks)
	a.Required("type", "attributes")
})

var areaAttributes = a.Type("AreaAttributes", func() {
	a.Description(`JSONAPI store for all the "attributes" of a Area. +See also see http://jsonapi.org/format/#document-resource-object-attributes`)
	a.Attribute("name", d.String, "The Area name", func() {
		a.Example("Area for Build related stuff")
	})
	a.Attribute("created-at", d.DateTime, "When the area was created", func() {
		a.Example("2016-11-29T23:18:14Z")
	})
	a.Attribute("version", d.Integer, "Version for optimistic concurrency control (optional during creating)", func() {
		a.Example(23)
コード例 #6
0
ファイル: spaces.go プロジェクト: Ritsyy/almighty-core
package design

import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

var space = a.Type("Space", func() {
	a.Attribute("type", d.String, "The type of the related resource", func() {
		a.Enum("spaces")
	})
	a.Attribute("id", d.UUID, "ID of the space", func() {
		a.Example("40bbdd3d-8b5d-4fd6-ac90-7236b669af04")
	})
	a.Attribute("attributes", spaceAttributes)
	a.Attribute("links", genericLinks)
	a.Required("type", "attributes")
	a.Attribute("relationships", spaceRelationships)
})

var spaceRelationships = a.Type("SpaceRelationships", func() {
	a.Attribute("iterations", relationGeneric, "Space can have one or many iterations")
	a.Attribute("areas", relationGeneric, "Space can have one or many areas")
})

var spaceAttributes = a.Type("SpaceAttributes", func() {
	a.Attribute("name", d.String, "Name of the space", func() {
		a.Example("foobar")
	})
	a.Attribute("description", d.String, "Description for the space", func() {
		a.Example("This is the foobar collaboration space")
コード例 #7
0
})

// workItemLinkTypeListMeta holds meta information for a work item link type array response
var workItemLinkTypeListMeta = a.Type("WorkItemLinkTypeListMeta", func() {
	a.Attribute("totalCount", d.Integer, func() {
		a.Minimum(0)
	})
	a.Required("totalCount")
})

// workItemLinkTypeData is the JSONAPI store for the data of a work item link type.
var workItemLinkTypeData = a.Type("WorkItemLinkTypeData", func() {
	a.Description(`JSONAPI store for the data of a work item link type.
See also http://jsonapi.org/format/#document-resource-object`)
	a.Attribute("type", d.String, func() {
		a.Enum("workitemlinktypes")
	})
	a.Attribute("id", d.String, "ID of work item link type (optional during creation)", func() {
		a.Example("40bbdd3d-8b5d-4fd6-ac90-7236b669af04")
	})
	a.Attribute("attributes", workItemLinkTypeAttributes)
	a.Attribute("relationships", workItemLinkTypeRelationships)
	a.Attribute("links", genericLinks)
	a.Required("type", "attributes")
})

// workItemLinkTypeAttributes is the JSONAPI store for all the "attributes" of a work item link type.
var workItemLinkTypeAttributes = a.Type("WorkItemLinkTypeAttributes", func() {
	a.Description(`JSONAPI store for all the "attributes" of a work item link type.
See also see http://jsonapi.org/format/#document-resource-object-attributes`)
	a.Attribute("name", d.String, "Name of the work item link type (required on creation, optional on update)", func() {
コード例 #8
0
ファイル: workitems.go プロジェクト: Ritsyy/almighty-core
// genericLinksForWorkItem defines generic relations links that are specific to a workitem
var genericLinksForWorkItem = a.Type("GenericLinksForWorkItem", func() {
	a.Attribute("self", d.String)
	a.Attribute("related", d.String)
	a.Attribute("sourceLinkTypes", d.String, `URL to those work item link types
in which the current work item can be used in the source part of the link`)
	a.Attribute("targetLinkTypes", d.String, `URL to those work item link types
in which the current work item can be used in the target part of the link`)
	a.Attribute("meta", a.HashOf(d.String, d.Any))
})

// workItem2 defines how an update payload will look like
var workItem2 = a.Type("WorkItem2", func() {
	a.Attribute("type", d.String, func() {
		a.Enum("workitems")
	})
	a.Attribute("id", d.String, "ID of the work item which is being updated", func() {
		a.Example("42")
	})
	a.Attribute("attributes", a.HashOf(d.String, d.Any), func() {
		a.Example(map[string]interface{}{"version": "1", "system.state": "new", "system.title": "Example story"})
	})
	a.Attribute("relationships", workItemRelationships)
	a.Attribute("links", genericLinksForWorkItem)
	a.Required("type", "attributes")
})

// WorkItemRelationships defines only `assignee` as of now. To be updated
var workItemRelationships = a.Type("WorkItemRelationships", func() {
	a.Attribute("assignees", relationGenericList, "This defines assignees of the Work Item")
コード例 #9
0
})

// workItemLinkListMeta holds meta information for a work item link array response
var workItemLinkListMeta = a.Type("WorkItemLinkListMeta", func() {
	a.Attribute("totalCount", d.Integer, func() {
		a.Minimum(0)
	})
	a.Required("totalCount")
})

// workItemLinkData is the JSONAPI store for the data of a work item link.
var workItemLinkData = a.Type("WorkItemLinkData", func() {
	a.Description(`JSONAPI store for the data of a work item.
See also http://jsonapi.org/format/#document-resource-object`)
	a.Attribute("type", d.String, func() {
		a.Enum("workitemlinks")
	})
	a.Attribute("id", d.String, "ID of work item link (optional during creation)", func() {
		a.Example("40bbdd3d-8b5d-4fd6-ac90-7236b669af04")
	})
	a.Attribute("attributes", workItemLinkAttributes)
	a.Attribute("relationships", workItemLinkRelationships)
	a.Attribute("links", genericLinks)
	a.Required("type", "relationships")
})

// workItemLinkAttributes is the JSONAPI store for all the "attributes" of a work item link type.
var workItemLinkAttributes = a.Type("WorkItemLinkAttributes", func() {
	a.Description(`JSONAPI store for all the "attributes" of a work item link.
See also see http://jsonapi.org/format/#document-resource-object-attributes`)
	a.Attribute("version", d.Integer, "Version for optimistic concurrency control (optional during creating)", func() {
コード例 #10
0
ファイル: render.go プロジェクト: Ritsyy/almighty-core
import (
	d "github.com/goadesign/goa/design"
	a "github.com/goadesign/goa/design/apidsl"
)

// MarkupRenderingPayload wraps the data in a JSONAPI compliant request
var markupRenderingPayload = a.Type("MarkupRenderingPayload", func() {
	a.Description("A MarkupRenderingPayload describes the values that a render request can hold.")
	a.Attribute("data", markupRenderingPayloadData)
	a.Required("data")
})

// MarkupRenderingPayloadData is the media type representing a rendering input.
var markupRenderingPayloadData = a.Type("MarkupRenderingPayloadData", func() {
	a.Attribute("type", d.String, func() {
		a.Enum("rendering")
	})
	a.Attribute("attributes", markupRenderingPayloadDataAttributes)
	a.Required("type")
	a.Required("attributes")
})

// MarkupRenderingPayloadData is the media type representing a rendering input.
var markupRenderingPayloadDataAttributes = a.Type("MarkupRenderingPayloadDataAttributes", func() {
	a.Attribute("content", d.String, "The content to render", func() {
		a.Example("# foo")
	})
	a.Attribute("markup", d.String, "The markup language associated with the content to render", func() {
		a.Example("Markdown")
	})
	a.Required("content")