Skip to content

Commit

Permalink
fix issue and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lerenn committed Aug 4, 2023
1 parent 9fe9a4d commit edd6dbc
Show file tree
Hide file tree
Showing 4 changed files with 414 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/asyncapi/specification.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ func (s *Specification) Process() {
s.Components.Process(*s)
}

// GetPublishSubscribeCount gets the count of 'publish' channels and the count
// of 'subscribe' channels inside the Specification
func (s Specification) GetPublishSubscribeCount() (publishCount, subscribeCount uint) {
for _, c := range s.Channels {
// Check that the publish channel is present
if c.Publish != nil {
publishCount++
} else if c.Subscribe != nil {
}

// Check that the subscribe channel is present
if c.Subscribe != nil {
subscribeCount++
}
}
Expand Down
3 changes: 3 additions & 0 deletions test/issues/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//go:generate go run ../../cmd/asyncapi-codegen -p issues -i ./issue-49.yaml -o ./issue-49.gen.go -g client,types,broker

package issues
Loading

0 comments on commit edd6dbc

Please sign in to comment.