New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an argument to CollectionOf() #1232
Conversation
It makes it possible to specify the collection identifier.
I don't know why travis was failed :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look great! I just suggested some tweaks to the comments, thank you.
design/apidsl/media_type.go
Outdated
for _, p := range paramAndDSL { | ||
param, ok = p.(string) | ||
if !ok { | ||
dslengine.ReportError("invalid CollectionOf argument, must be a string", p) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
design/apidsl/media_type_test.go
Outdated
}) | ||
}) | ||
|
||
Context("defined with the collectio identifier", func() { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
design/apidsl/media_type.go
Outdated
func CollectionOf(v interface{}, apidsl ...func()) *design.MediaTypeDefinition { | ||
// | ||
// CollectionOf(BottleMedia) // If the identifier of BottleMedia is "vnd.goa.bottle', | ||
// // Content-Type will be "vnd.goa.bottle; type=collection". |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
design/apidsl/media_type.go
Outdated
@@ -376,9 +376,17 @@ func Link(name string, view ...string) { | |||
// CollectionOf creates a collection media type from its element media type. A collection media |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
design/apidsl/media_type.go
Outdated
@@ -376,9 +376,17 @@ func Link(name string, view ...string) { | |||
// CollectionOf creates a collection media type from its element media type. A collection media | |||
// type represents the content of responses that return a collection of resources such as "list" | |||
// actions. This function can be called from any place where a media type can be used. | |||
// | |||
// The resulting media type identifier is built from the element media type by appending the media |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
design/apidsl/media_type.go
Outdated
// | ||
// The collection identifier can be specified as second argument. | ||
// | ||
// CollectionOf(BottleMedia, "vnd.goa.bottles") // Content-Type will be "vnd.goa.bottles". |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
I added a fixing commit! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Would you mind backporting this to v1? Thank you! |
* Add an argument to CollectionOf() It makes it possible to specify the collection identifier. * Fix documents and a test description
It makes it possible to specify the collection identifier.