Open
Description
Hi, I'm new to goa and I want to map a path param e.g. product_id to a payload attribute id.
My design:
Service:
var _ = Service("products", func() {
Description("The product service provides an API for managing products.")
HTTP(func() {
Path("/products")
})
// update product by id
Method("update by id", func() {
Payload(UpdateProductPayload)
Result(UpdateProductPayload, func() {
View("default")
})
Error("no_criteria", String, "Missing criteria")
Error("no_match", String, "No product found with specified id")
HTTP(func() {
POST("/{product_id}")
Param("product_id:id")
Response(StatusOK)
Response("no_criteria", StatusBadRequest)
Response("no_match", StatusNotFound)
})
})
})
Payload Model:
var UpdateProductPayload = Type("UpdateProductPayload", func() {
Attribute("id", String, "Product ID", func() {
Example("83d83ec2-d2ca-49ff-bbea-b92b5c3be202")
})
Attribute("name", String, "Product Name", func() {
Example("Apple")
})
})
Generating the code results in:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x60 pc=0x1023a3028]
Metadata
Assignees
Labels
No labels
Activity