Create a gist now

Instantly share code, notes, and snippets.

@kawaken /go.json
Last active Jul 9, 2017

What would you like to do?
vscode goa snippets
{
/* goa commons */
"goa design import": {
"prefix": "goa-import",
"body": [
". \"github.com/goadesign/goa/design\"",
". \"github.com/goadesign/goa/design/apidsl\""
]
},
"goa design API declaration": {
"prefix": "goa-API",
"body": [
"var _ = API(\"${1:api name}\", func() {",
"\tTitle(\"${2:${1:api name}}\")",
"\tDescription(\"${3:Description}\")",
"\tScheme(\"${4:https}\")",
"\tHost(\"${5:localhost:8080}\")",
"\\})"
]
},
"goa design Resource declaration": {
"prefix": "goa-Resource",
"body": [
"var _ = Resource(\"${1:name}\", func() {",
"\tBasePath(\"/${2:${1:name}}\")",
"\tDefaultMedia($3)",
"",
"\t// Action definitions below",
"\t$0",
"\\})"
]
},
"goa design Action declaration": {
"prefix": "goa-Action",
"body": [
"Action(\"${1:name}\", func() {",
"\tDescription(\"${2:Description}\")",
"\tRouting($3)",
"\tParams(func() {",
"\t\t// Param definitions below",
"\t\t$0",
"\t})",
"\tResponse(OK)",
"\tResponse(NotFound)",
"\\})"
]
},
"goa design MediaType declaration": {
"prefix": "goa-MediaType",
"body": [
"var ${1:YourMedia} = MediaType(\"application/vnd.${2:your.app}+json\", func() {",
"\tDescription(\"Description\")",
"\tAttributes(func() {",
"\t\t// Attribute definitions below",
"\t\tAttribute(\"id\", Integer, \"Unique $1 ID\")",
"\t})",
"\tView(\"${4:default}\", func() {",
"\t\t// rendered Attribute definitions below",
"\t\tAttribute(\"id\")",
"\t})",
"\\})"
]
},
/* Routing */
"goa design Routing CONNECT": {
"prefix": "goa-Routing-CONNECT",
"body": "CONNECT(\"${routing}\")"
},
"goa design Routing DELETE": {
"prefix": "goa-Routing-DELETE",
"body": "DELETE(\"${routing}\")"
},
"goa design Routing GET": {
"prefix": "goa-Routing-GET",
"body": "GET(\"${routing}\")"
},
"goa design Routing HEAD": {
"prefix": "goa-Routing-HEAD",
"body": "HEAD(\"${routing}\")"
},
"goa design Routing OPTIONS": {
"prefix": "goa-Routing-OPTIONS",
"body": "OPTIONS(\"${routing}\")"
},
"goa design Routing PATCH": {
"prefix": "goa-Routing-PATCH",
"body": "PATCH(\"${routing}\")"
},
"goa design Routing POST": {
"prefix": "goa-Routing-POST",
"body": "POST(\"${routing}\")"
},
"goa design Routing PUT": {
"prefix": "goa-Routing-PUT",
"body": "PUT(\"${routing}\")"
},
"goa design Routing TRACE": {
"prefix": "goa-Routing-TRACE",
"body": "TRACE(\"${routing}\")"
},
/* Attribute, Param, Member, Header */
"goa design Attribute declaration": {
"prefix": "goa-Attribute",
"body": "Attribute(\"${1:name}\")",
"description": "Defines an Attribute with name only"
},
"goa design Attribute declaration with dsl": {
"prefix": "goa-Attribute-dsl",
"body": [
"Attribute(\"${1:name}\", func() {",
"\t$2",
"\\})"
],
"description": "Defines an Attribute with func for DSL"
},
"goa design Attribute declaration with dataType": {
"prefix": "goa-Attribute-dataType",
"body": "Attribute(\"${1:name}\", ${2:dataType})",
"description": "Defines an Attribute with dataType"
},
"goa design Attribute declaration with dataType and dsl": {
"prefix": "goa-Attribute-dataType-dsl",
"body": [
"Attribute(\"${1:name}\", ${2:dataType}, func() {",
"\t$3",
"\\})"
],
"description": "Defines an Attribute with dataType and func for DSL"
},
"goa design Attribute declaration with dataType and description": {
"prefix": "goa-Attribute-dataType-description",
"body": "Attribute(\"${1:name}\", ${2:dataType}, \"${3:$1}\")",
"description": "Defines an Attribute with dataType, description and func for DSL"
},
"goa design Attribute declaration with dataType, description and dsl": {
"prefix": "goa-Attribute-dataType-description-dsl",
"body": [
"Attribute(\"${1:name}\", ${2:dataType}, \"${3:$1}\", func() {",
"\t$4",
"\\})"
],
"description": "Defines an Attribute with dataType, description and func for DSL"
},
"goa design Param declaration": {
"prefix": "goa-Param",
"body": "Param(\"${1:name}\")",
"description": "Defines an Param with name only"
},
"goa design Param declaration with dsl": {
"prefix": "goa-Param-dsl",
"body": [
"Param(\"${1:name}\", func() {",
"\t$2",
"\\})"
],
"description": "Defines an Param with func for DSL"
},
"goa design Param declaration with dataType": {
"prefix": "goa-Param-dataType",
"body": "Param(\"${1:name}\", ${2:dataType})",
"description": "Defines an Param with dataType"
},
"goa design Param declaration with dataType and dsl": {
"prefix": "goa-Param-dataType-dsl",
"body": [
"Param(\"${1:name}\", ${2:dataType}, func() {",
"\t$3",
"\\})"
],
"description": "Defines an Param with dataType and func for DSL"
},
"goa design Param declaration with dataType and description": {
"prefix": "goa-Param-dataType-description",
"body": "Param(\"${1:name}\", ${2:dataType}, \"${3:$1}\")",
"description": "Defines an Param with dataType, description and func for DSL"
},
"goa design Param declaration with dataType, description and dsl": {
"prefix": "goa-Param-dataType-description-dsl",
"body": [
"Param(\"${1:name}\", ${2:dataType}, \"${3:$1}\", func() {",
"\t$4",
"\\})"
],
"description": "Defines an Param with dataType, description and func for DSL"
},
"goa design Member declaration": {
"prefix": "goa-Member",
"body": "Member(\"${1:name}\")",
"description": "Defines an Member with name only"
},
"goa design Member declaration with dsl": {
"prefix": "goa-Member-dsl",
"body": [
"Member(\"${1:name}\", func() {",
"\t$2",
"\\})"
],
"description": "Defines an Member with func for DSL"
},
"goa design Member declaration with dataType": {
"prefix": "goa-Member-dataType",
"body": "Member(\"${1:name}\", ${2:dataType})",
"description": "Defines an Member with dataType"
},
"goa design Member declaration with dataType and dsl": {
"prefix": "goa-Member-dataType-dsl",
"body": [
"Member(\"${1:name}\", ${2:dataType}, func() {",
"\t$3",
"\\})"
],
"description": "Defines an Member with dataType and func for DSL"
},
"goa design Member declaration with dataType and description": {
"prefix": "goa-Member-dataType-description",
"body": "Member(\"${1:name}\", ${2:dataType}, \"${3:$1}\")",
"description": "Defines an Member with dataType, description and func for DSL"
},
"goa design Member declaration with dataType, description and dsl": {
"prefix": "goa-Member-dataType-description-dsl",
"body": [
"Member(\"${1:name}\", ${2:dataType}, \"${3:$1}\", func() {",
"\t$4",
"\\})"
],
"description": "Defines an Member with dataType, description and func for DSL"
},
"goa design Header declaration": {
"prefix": "goa-Header",
"body": "Header(\"${1:name}\")",
"description": "Defines an Header with name only"
},
"goa design Header declaration with dsl": {
"prefix": "goa-Header-dsl",
"body": [
"Header(\"${1:name}\", func() {",
"\t$2",
"\\})"
],
"description": "Defines an Header with func for DSL"
},
"goa design Header declaration with dataType": {
"prefix": "goa-Header-dataType",
"body": "Header(\"${1:name}\", ${2:dataType})",
"description": "Defines an Header with dataType"
},
"goa design Header declaration with dataType and dsl": {
"prefix": "goa-Header-dataType-dsl",
"body": [
"Header(\"${1:name}\", ${2:dataType}, func() {",
"\t$3",
"\\})"
],
"description": "Defines an Header with dataType and func for DSL"
},
"goa design Header declaration with dataType and description": {
"prefix": "goa-Header-dataType-description",
"body": "Header(\"${1:name}\", ${2:dataType}, \"${3:$1}\")",
"description": "Defines an Header with dataType, description and func for DSL"
},
"goa design Header declaration with dataType, description and dsl": {
"prefix": "goa-Header-dataType-description-dsl",
"body": [
"Header(\"${1:name}\", ${2:dataType}, \"${3:$1}\", func() {",
"\t$4",
"\\})"
],
"description": "Defines an Header with dataType, description and func for DSL"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment