{"swagger":"2.0","info":{"title":"The virtual wine cellar","description":"A basic example of a CRUD API implemented with goa","contact":{"name":"goa team","email":"admin@goa.design","url":"http://goa.design"},"license":{"name":"MIT","url":"https://github.com/goadesign/goa/blob/master/LICENSE"},"version":""},"host":"localhost:8081","schemes":["http"],"consumes":["application/json","application/xml","application/gob","application/x-gob"],"produces":["application/json","application/xml","application/gob","application/x-gob"],"paths":{"/cellar/_ah/health":{"get":{"tags":["health"],"summary":"health health","description":"Perform health check.","operationId":"health#health","produces":["text/plain"],"responses":{"200":{"description":"OK"}},"schemes":["http"]}},"/cellar/accounts":{"get":{"tags":["account"],"summary":"list account","description":"Retrieve all accounts.","operationId":"account#list","produces":["application/vnd.account+json; type=collection"],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/AccountCollection"}}},"schemes":["http"]},"post":{"tags":["account"],"summary":"create account","description":"Create new account","operationId":"account#create","produces":["application/vnd.goa.error"],"parameters":[{"name":"payload","in":"body","required":true,"schema":{"$ref":"#/definitions/CreateAccountPayload"}}],"responses":{"201":{"description":"Resource created","headers":{"Location":{"description":"href to created resource","type":"string","pattern":"/accounts/[0-9]+"}}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]}},"/cellar/accounts/{accountID}":{"get":{"tags":["account"],"summary":"show account","description":"Retrieve account with given id. IDs 1 and 2 pre-exist in the system.","operationId":"account#show","produces":["application/vnd.account+json","application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer","minimum":1}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Account"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]},"put":{"tags":["account"],"summary":"update account","description":"Change account name","operationId":"account#update","produces":["application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer"},{"name":"payload","in":"body","required":true,"schema":{"$ref":"#/definitions/UpdateAccountPayload"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]},"delete":{"tags":["account"],"summary":"delete account","operationId":"account#delete","produces":["application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer"}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]}},"/cellar/accounts/{accountID}/bottles":{"get":{"tags":["bottle"],"summary":"list bottle","description":"List all bottles in account optionally filtering by year","operationId":"bottle#list","produces":["application/vnd.bottle+json; type=collection","application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer","minimum":1},{"name":"years","in":"query","description":"Filter by years","required":false,"type":"array","items":{"type":"integer"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/BottleCollection"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]},"post":{"tags":["bottle"],"summary":"create bottle","description":"Record new bottle","operationId":"bottle#create","produces":["application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer","minimum":1},{"name":"payload","in":"body","required":true,"schema":{"$ref":"#/definitions/CreateBottlePayload"}}],"responses":{"201":{"description":"Resource created","headers":{"Location":{"description":"href to created resource","type":"string","pattern":"^/accounts/[0-9]+/bottles/[0-9]+$"}}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]}},"/cellar/accounts/{accountID}/bottles/{bottleID}":{"get":{"tags":["bottle"],"summary":"show bottle","description":"Retrieve bottle with given id","operationId":"bottle#show","produces":["application/vnd.bottle+json","application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer","minimum":1},{"name":"bottleID","in":"path","required":true,"type":"integer"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Bottle"}},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]},"delete":{"tags":["bottle"],"summary":"delete bottle","operationId":"bottle#delete","produces":["application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer","minimum":1},{"name":"bottleID","in":"path","required":true,"type":"integer"}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]},"patch":{"tags":["bottle"],"summary":"update bottle","operationId":"bottle#update","produces":["application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer","minimum":1},{"name":"bottleID","in":"path","required":true,"type":"integer"},{"name":"payload","in":"body","required":true,"schema":{"$ref":"#/definitions/BottlePayload"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]}},"/cellar/accounts/{accountID}/bottles/{bottleID}/actions/rate":{"put":{"tags":["bottle"],"summary":"rate bottle","operationId":"bottle#rate","produces":["application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer","minimum":1},{"name":"bottleID","in":"path","required":true,"type":"integer"},{"name":"payload","in":"body","required":true,"schema":{"$ref":"#/definitions/RateBottlePayload"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}},"404":{"description":"Not Found"}},"schemes":["http"]}},"/cellar/accounts/{accountID}/bottles/{bottleID}/watch":{"get":{"tags":["bottle"],"summary":"watch bottle","description":"Retrieve bottle with given id","operationId":"bottle#watch","produces":["application/vnd.goa.error"],"parameters":[{"name":"accountID","in":"path","description":"Account ID","required":true,"type":"integer","minimum":1},{"name":"bottleID","in":"path","required":true,"type":"integer"}],"responses":{"101":{"description":"Switching Protocols"},"400":{"description":"Bad Request","schema":{"$ref":"#/definitions/error"}}},"schemes":["ws"]}},"/js/{filepath}":{"get":{"summary":"Download public/js","operationId":"js#/js/*filepath","parameters":[{"name":"filepath","in":"path","description":"Relative file path","required":true,"type":"string"}],"responses":{"200":{"description":"File downloaded","schema":{"type":"file"}},"404":{"description":"File not found","schema":{"$ref":"#/definitions/error"}}},"schemes":["http"]}},"/swagger.json":{"get":{"summary":"Download public/swagger/swagger.json","operationId":"swagger#/swagger.json","responses":{"200":{"description":"File downloaded","schema":{"type":"file"}}},"schemes":["http"]}},"/ui":{"get":{"summary":"Download public/html/index.html","operationId":"public#/ui","responses":{"200":{"description":"File downloaded","schema":{"type":"file"}}},"schemes":["http"]}}},"definitions":{"Account":{"title":"Mediatype identifier: application/vnd.account+json; view=default","type":"object","properties":{"created_at":{"type":"string","description":"Date of creation","example":"2015-09-23T18:51:57Z","format":"date-time"},"created_by":{"type":"string","description":"Email of account owner","example":"me@goa.design","format":"email"},"href":{"type":"string","description":"API href of account","example":"/accounts/1"},"id":{"type":"integer","description":"ID of account","example":1,"format":"int64"},"name":{"type":"string","description":"Name of account","example":"test"}},"description":"A tenant account (default view)","example":{"created_at":"2015-09-23T18:51:57Z","created_by":"me@goa.design","href":"/accounts/1","id":1,"name":"test"},"required":["id","href","name","created_at","created_by"]},"AccountCollection":{"title":"Mediatype identifier: application/vnd.account+json; type=collection; view=default","type":"array","items":{"$ref":"#/definitions/Account"},"description":"AccountCollection is the media type for an array of Account (default view)","example":[{"created_at":"2015-09-23T18:51:57Z","created_by":"me@goa.design","href":"/accounts/1","id":1,"name":"test"},{"created_at":"2015-09-23T18:51:57Z","created_by":"me@goa.design","href":"/accounts/1","id":1,"name":"test"}]},"AccountLink":{"title":"Mediatype identifier: application/vnd.account+json; view=link","type":"object","properties":{"href":{"type":"string","description":"API href of account","example":"/accounts/1"},"id":{"type":"integer","description":"ID of account","example":1,"format":"int64"}},"description":"A tenant account (link view)","example":{"href":"/accounts/1","id":1},"required":["id","href"]},"AccountTiny":{"title":"Mediatype identifier: application/vnd.account+json; view=tiny","type":"object","properties":{"href":{"type":"string","description":"API href of account","example":"/accounts/1"},"id":{"type":"integer","description":"ID of account","example":1,"format":"int64"},"name":{"type":"string","description":"Name of account","example":"test"}},"description":"A tenant account (tiny view)","example":{"href":"/accounts/1","id":1,"name":"test"},"required":["id","href","name"]},"Bottle":{"title":"Mediatype identifier: application/vnd.bottle+json; view=default","type":"object","properties":{"account":{"$ref":"#/definitions/AccountTiny"},"href":{"type":"string","description":"API href of bottle","example":"/accounts/1/bottles/1"},"id":{"type":"integer","description":"ID of bottle","example":1,"format":"int64"},"links":{"$ref":"#/definitions/BottleLinks"},"name":{"type":"string","example":"Number 8","minLength":2},"rating":{"type":"integer","description":"Rating of bottle between 1 and 5","example":3,"minimum":1,"maximum":5},"varietal":{"type":"string","example":"Merlot","minLength":4},"vineyard":{"type":"string","example":"Asti","minLength":2},"vintage":{"type":"integer","example":2012,"minimum":1900,"maximum":2020}},"description":"A bottle of wine (default view)","example":{"account":{"href":"/accounts/1","id":1,"name":"test"},"href":"/accounts/1/bottles/1","id":1,"links":{"account":{"href":"/accounts/1","id":1}},"name":"Number 8","rating":3,"varietal":"Merlot","vineyard":"Asti","vintage":2012},"required":["id","href","name","vineyard","varietal","vintage"]},"BottleCollection":{"title":"Mediatype identifier: application/vnd.bottle+json; type=collection; view=default","type":"array","items":{"$ref":"#/definitions/Bottle"},"description":"BottleCollection is the media type for an array of Bottle (default view)","example":[{"account":{"href":"/accounts/1","id":1,"name":"test"},"href":"/accounts/1/bottles/1","id":1,"links":{"account":{"href":"/accounts/1","id":1}},"name":"Number 8","rating":3,"varietal":"Merlot","vineyard":"Asti","vintage":2012},{"account":{"href":"/accounts/1","id":1,"name":"test"},"href":"/accounts/1/bottles/1","id":1,"links":{"account":{"href":"/accounts/1","id":1}},"name":"Number 8","rating":3,"varietal":"Merlot","vineyard":"Asti","vintage":2012}]},"BottleLinks":{"title":"BottleLinks","type":"object","properties":{"account":{"$ref":"#/definitions/AccountLink"}},"description":"BottleLinks contains links to related resources of Bottle.","example":{"account":{"href":"/accounts/1","id":1}}},"BottlePayload":{"title":"BottlePayload","type":"object","properties":{"color":{"type":"string","example":"white","enum":["red","white","rose","yellow","sparkling"]},"country":{"type":"string","example":"USA","minLength":2},"name":{"type":"string","example":"Number 8","minLength":2},"region":{"type":"string","example":"Napa Valley"},"review":{"type":"string","example":"Great and inexpensive","minLength":3,"maxLength":300},"sweetness":{"type":"integer","example":1,"minimum":1,"maximum":5},"varietal":{"type":"string","example":"Merlot","minLength":4},"vineyard":{"type":"string","example":"Asti","minLength":2},"vintage":{"type":"integer","example":2012,"minimum":1900,"maximum":2020}},"example":{"color":"white","country":"USA","name":"Number 8","region":"Napa Valley","review":"Great and inexpensive","sweetness":1,"varietal":"Merlot","vineyard":"Asti","vintage":2012}},"CreateAccountPayload":{"title":"CreateAccountPayload","type":"object","properties":{"name":{"type":"string","description":"Name of account","example":"test"}},"example":{"name":"test"},"required":["name"]},"CreateBottlePayload":{"title":"CreateBottlePayload","type":"object","properties":{"color":{"type":"string","example":"white","enum":["red","white","rose","yellow","sparkling"]},"country":{"type":"string","example":"USA","minLength":2},"name":{"type":"string","example":"Number 8","minLength":2},"region":{"type":"string","example":"Napa Valley"},"review":{"type":"string","example":"Great and inexpensive","minLength":3,"maxLength":300},"sweetness":{"type":"integer","example":1,"minimum":1,"maximum":5},"varietal":{"type":"string","example":"Merlot","minLength":4},"vineyard":{"type":"string","example":"Asti","minLength":2},"vintage":{"type":"integer","example":2012,"minimum":1900,"maximum":2020}},"example":{"color":"white","country":"USA","name":"Number 8","region":"Napa Valley","review":"Great and inexpensive","sweetness":1,"varietal":"Merlot","vineyard":"Asti","vintage":2012},"required":["name","vineyard","varietal","vintage","color"]},"RateBottlePayload":{"title":"RateBottlePayload","type":"object","properties":{"rating":{"type":"integer","description":"Rating of bottle between 1 and 5","example":3,"minimum":1,"maximum":5}},"example":{"rating":3},"required":["rating"]},"UpdateAccountPayload":{"title":"UpdateAccountPayload","type":"object","properties":{"name":{"type":"string","description":"Name of account","example":"test"}},"example":{"name":"test"},"required":["name"]},"error":{"title":"Mediatype identifier: application/vnd.goa.error; view=default","type":"object","properties":{"code":{"type":"string","description":"an application-specific error code, expressed as a string value.","example":"invalid_value"},"detail":{"type":"string","description":"a human-readable explanation specific to this occurrence of the problem.","example":"Value of ID must be an integer"},"id":{"type":"string","description":"a unique identifier for this particular occurrence of the problem.","example":"3F1FKVRR"},"meta":{"type":"object","description":"a meta object containing non-standard meta-information about the error.","example":{"timestamp":1458609066},"additionalProperties":true},"status":{"type":"string","description":"the HTTP status code applicable to this problem, expressed as a string value.","example":"400"}},"description":"Error response media type (default view)","example":{"code":"invalid_value","detail":"Value of ID must be an integer","id":"3F1FKVRR","meta":{"timestamp":1458609066},"status":"400"}}},"responses":{"NoContent":{"description":"No Content"},"NotFound":{"description":"Not Found"},"OK":{"description":"OK","schema":{"$ref":"#/definitions/Account"}},"SwitchingProtocols":{"description":"Switching Protocols"}},"externalDocs":{"description":"goa guide","url":"http://goa.design/getting-started.html"}}