From 4872b24f991d2cccad8b2c665cfb995cb2d37a52 Mon Sep 17 00:00:00 2001 From: Louis FRADIN Date: Fri, 12 Jun 2026 18:07:39 +0200 Subject: [PATCH] fix(generators): add missing doc comments to generated code (#141) Several exported symbols were generated without a doc comment (MessageWithCorrelationID, Error, the Error() method and the message constructors), and the Request* function's doc comment was detached from it by a blank line. Add the missing comments and reattach the Request comment so every exported declaration in generated code is documented. Fixes #141 Co-Authored-By: Claude Opus 4.8 (1M context) --- examples/helloworld/v2/nats/app/app.gen.go | 4 + examples/helloworld/v2/nats/user/user.gen.go | 4 + examples/helloworld/v3/nats/app/app.gen.go | 4 + examples/helloworld/v3/nats/user/user.gen.go | 4 + examples/ping/v2/kafka/app/app.gen.go | 5 + examples/ping/v2/kafka/user/user.gen.go | 5 + .../ping/v2/nats-jetstream/app/app.gen.go | 5 + .../ping/v2/nats-jetstream/user/user.gen.go | 5 + examples/ping/v2/nats/app/app.gen.go | 5 + examples/ping/v2/nats/user/user.gen.go | 5 + examples/ping/v3/kafka/app/app.gen.go | 5 + examples/ping/v3/kafka/user/user.gen.go | 6 +- .../ping/v3/nats-jetstream/app/app.gen.go | 5 + .../ping/v3/nats-jetstream/user/user.gen.go | 6 +- examples/ping/v3/nats/app/app.gen.go | 5 + examples/ping/v3/nats/user/user.gen.go | 6 +- .../generators/v2/templates/message.tmpl | 1 + .../generators/v2/templates/types.tmpl | 3 + .../generators/v3/templates/controller.tmpl | 1 - .../generators/v3/templates/message.tmpl | 1 + .../generators/v3/templates/types.tmpl | 3 + test/v2/issues/101/asyncapi.gen.go | 4 + test/v2/issues/114/asyncapi.gen.go | 4 + test/v2/issues/122/asyncapi.gen.go | 4 + test/v2/issues/129/camel/asyncapi.gen.go | 4 + test/v2/issues/129/kebab/asyncapi.gen.go | 4 + test/v2/issues/129/none/asyncapi.gen.go | 4 + test/v2/issues/129/snake/asyncapi.gen.go | 4 + test/v2/issues/131/asyncapi.gen.go | 4 + test/v2/issues/135/asyncapi.gen.go | 8 + test/v2/issues/137/asyncapi.gen.go | 3 + test/v2/issues/164/asyncapi.gen.go | 4 + test/v2/issues/169/asyncapi.gen.go | 4 + test/v2/issues/185/asyncapi.gen.go | 3 + test/v2/issues/186/asyncapi.gen.go | 5 + test/v2/issues/190/asyncapi.gen.go | 5 + test/v2/issues/192/asyncapi.gen.go | 3 + test/v2/issues/214/asyncapi.gen.go | 4 + test/v2/issues/215/asyncapi.gen.go | 4 + test/v2/issues/216/asyncapi.gen.go | 4 + test/v2/issues/220/camel/asyncapi.gen.go | 4 + test/v2/issues/220/none/asyncapi.gen.go | 4 + test/v2/issues/222/asyncapi.gen.go | 4 + test/v2/issues/233/asyncapi.gen.go | 4 + test/v2/issues/245/asyncapi.gen.go | 4 + test/v2/issues/255/default/asyncapi.gen.go | 4 + .../v2/issues/255/ignoredates/asyncapi.gen.go | 4 + test/v2/issues/258/asyncapi.gen.go | 4 + test/v2/issues/259/default/asyncapi.gen.go | 4 + .../issues/259/forcepointers/asyncapi.gen.go | 4 + test/v2/issues/261/asyncapi.gen.go | 4 + test/v2/issues/262/asyncapi.gen.go | 4 + test/v2/issues/267/asyncapi.gen.go | 4 + test/v2/issues/275/asyncapi.gen.go | 4 + test/v2/issues/290/asyncapi.gen.go | 4 + test/v2/issues/49/asyncapi.gen.go | 6 + test/v2/issues/73/v1/asyncapi.gen.go | 4 + test/v2/issues/73/v2/asyncapi.gen.go | 4 + test/v2/issues/74/asyncapi.gen.go | 4 + test/v2/issues/97/asyncapi.gen.go | 6 + test/v2/issues/99/asyncapi.gen.go | 4 + test/v3/issues/129/camel/asyncapi.gen.go | 4 + test/v3/issues/129/kebab/asyncapi.gen.go | 4 + test/v3/issues/129/none/asyncapi.gen.go | 4 + test/v3/issues/129/snake/asyncapi.gen.go | 4 + test/v3/issues/130/decoupling/asyncapi.gen.go | 4 + test/v3/issues/130/parameters/asyncapi.gen.go | 4 + .../issues/130/requestreply/asyncapi.gen.go | 9 +- test/v3/issues/131/asyncapi.gen.go | 4 + test/v3/issues/135/asyncapi.gen.go | 3 + test/v3/issues/137/asyncapi.gen.go | 3 + test/v3/issues/138/asyncapi.gen.go | 3 + test/v3/issues/139/asyncapi.gen.go | 4 + test/v3/issues/141/asyncapi.gen.go | 881 ++++++++++++++++++ test/v3/issues/141/asyncapi.yaml | 54 ++ test/v3/issues/141/suite_test.go | 69 ++ test/v3/issues/145/asyncapi.gen.go | 6 +- test/v3/issues/148/asyncapi.gen.go | 6 +- test/v3/issues/150/asyncapi.gen.go | 3 + test/v3/issues/152/asyncapi.gen.go | 3 + test/v3/issues/154/asyncapi.gen.go | 3 + test/v3/issues/156/asyncapi.gen.go | 4 + test/v3/issues/162/asyncapi.gen.go | 6 +- test/v3/issues/164/asyncapi.gen.go | 4 + test/v3/issues/173/asyncapi.gen.go | 5 + test/v3/issues/175/asyncapi.gen.go | 6 + test/v3/issues/181/asyncapi.gen.go | 6 +- test/v3/issues/185/asyncapi.gen.go | 3 + test/v3/issues/186/asyncapi.gen.go | 5 + test/v3/issues/190/asyncapi.gen.go | 5 + test/v3/issues/192/asyncapi.gen.go | 3 + test/v3/issues/209/asyncapi.gen.go | 3 + test/v3/issues/211/asyncapi.gen.go | 4 + test/v3/issues/214/asyncapi.gen.go | 4 + test/v3/issues/215/asyncapi.gen.go | 4 + test/v3/issues/216/asyncapi.gen.go | 4 + test/v3/issues/220/camel/asyncapi.gen.go | 4 + test/v3/issues/220/none/asyncapi.gen.go | 4 + test/v3/issues/222/asyncapi.gen.go | 4 + test/v3/issues/224/asyncapi.gen.go | 4 + test/v3/issues/224/openapidep/asyncapi.gen.go | 4 + test/v3/issues/233/asyncapi.gen.go | 4 + test/v3/issues/241/asyncapi.gen.go | 4 + test/v3/issues/245/asyncapi.gen.go | 4 + test/v3/issues/255/default/asyncapi.gen.go | 4 + .../v3/issues/255/ignoredates/asyncapi.gen.go | 4 + test/v3/issues/258/asyncapi.gen.go | 4 + test/v3/issues/259/default/asyncapi.gen.go | 4 + .../issues/259/forcepointers/asyncapi.gen.go | 4 + test/v3/issues/261/asyncapi.gen.go | 4 + test/v3/issues/262/asyncapi.gen.go | 4 + test/v3/issues/267/asyncapi.gen.go | 4 + test/v3/issues/275/asyncapi.gen.go | 4 + test/v3/issues/283/asyncapi.gen.go | 5 + test/v3/issues/292/asyncapi.gen.go | 6 +- test/v3/issues/294/asyncapi.gen.go | 4 + test/v3/issues/296/asyncapi.gen.go | 4 + test/v3/issues/299/asyncapi.gen.go | 4 + test/v3/issues/301/asyncapi.gen.go | 4 + 119 files changed, 1480 insertions(+), 11 deletions(-) create mode 100644 test/v3/issues/141/asyncapi.gen.go create mode 100644 test/v3/issues/141/asyncapi.yaml create mode 100644 test/v3/issues/141/suite_test.go diff --git a/examples/helloworld/v2/nats/app/app.gen.go b/examples/helloworld/v2/nats/app/app.gen.go index f1f3c1a1..f6c3b6d2 100644 --- a/examples/helloworld/v2/nats/app/app.gen.go +++ b/examples/helloworld/v2/nats/app/app.gen.go @@ -305,16 +305,19 @@ func (c *AppController) UnsubscribeHello(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -325,6 +328,7 @@ type HelloMessage struct { Payload string } +// NewHelloMessage creates a new HelloMessage with default values if any. func NewHelloMessage() HelloMessage { var msg HelloMessage diff --git a/examples/helloworld/v2/nats/user/user.gen.go b/examples/helloworld/v2/nats/user/user.gen.go index cb89964b..cd2f936a 100644 --- a/examples/helloworld/v2/nats/user/user.gen.go +++ b/examples/helloworld/v2/nats/user/user.gen.go @@ -179,16 +179,19 @@ func (c *UserController) PublishHello( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -199,6 +202,7 @@ type HelloMessage struct { Payload string } +// NewHelloMessage creates a new HelloMessage with default values if any. func NewHelloMessage() HelloMessage { var msg HelloMessage diff --git a/examples/helloworld/v3/nats/app/app.gen.go b/examples/helloworld/v3/nats/app/app.gen.go index 1143f50e..16c7e03b 100644 --- a/examples/helloworld/v3/nats/app/app.gen.go +++ b/examples/helloworld/v3/nats/app/app.gen.go @@ -313,16 +313,19 @@ func (c *AppController) UnsubscribeFromReceiveHelloOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -333,6 +336,7 @@ type SayHelloMessageFromHelloChannel struct { Payload string } +// NewSayHelloMessageFromHelloChannel creates a new SayHelloMessageFromHelloChannel with default values if any. func NewSayHelloMessageFromHelloChannel() SayHelloMessageFromHelloChannel { var msg SayHelloMessageFromHelloChannel diff --git a/examples/helloworld/v3/nats/user/user.gen.go b/examples/helloworld/v3/nats/user/user.gen.go index 34bb5e0c..8bef1e84 100644 --- a/examples/helloworld/v3/nats/user/user.gen.go +++ b/examples/helloworld/v3/nats/user/user.gen.go @@ -182,16 +182,19 @@ func (c *UserController) SendToReceiveHelloOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -202,6 +205,7 @@ type SayHelloMessageFromHelloChannel struct { Payload string } +// NewSayHelloMessageFromHelloChannel creates a new SayHelloMessageFromHelloChannel with default values if any. func NewSayHelloMessageFromHelloChannel() SayHelloMessageFromHelloChannel { var msg SayHelloMessageFromHelloChannel diff --git a/examples/ping/v2/kafka/app/app.gen.go b/examples/ping/v2/kafka/app/app.gen.go index e155ac6f..85c60580 100644 --- a/examples/ping/v2/kafka/app/app.gen.go +++ b/examples/ping/v2/kafka/app/app.gen.go @@ -347,16 +347,19 @@ func (c *AppController) PublishPong( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -376,6 +379,7 @@ type PingMessage struct { Payload string } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -477,6 +481,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v2/kafka/user/user.gen.go b/examples/ping/v2/kafka/user/user.gen.go index bae2ca50..2bb5bfaf 100644 --- a/examples/ping/v2/kafka/user/user.gen.go +++ b/examples/ping/v2/kafka/user/user.gen.go @@ -465,16 +465,19 @@ func (c *UserController) waitForPongNextMessage( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -494,6 +497,7 @@ type PingMessage struct { Payload string } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -595,6 +599,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v2/nats-jetstream/app/app.gen.go b/examples/ping/v2/nats-jetstream/app/app.gen.go index e155ac6f..85c60580 100644 --- a/examples/ping/v2/nats-jetstream/app/app.gen.go +++ b/examples/ping/v2/nats-jetstream/app/app.gen.go @@ -347,16 +347,19 @@ func (c *AppController) PublishPong( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -376,6 +379,7 @@ type PingMessage struct { Payload string } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -477,6 +481,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v2/nats-jetstream/user/user.gen.go b/examples/ping/v2/nats-jetstream/user/user.gen.go index bae2ca50..2bb5bfaf 100644 --- a/examples/ping/v2/nats-jetstream/user/user.gen.go +++ b/examples/ping/v2/nats-jetstream/user/user.gen.go @@ -465,16 +465,19 @@ func (c *UserController) waitForPongNextMessage( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -494,6 +497,7 @@ type PingMessage struct { Payload string } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -595,6 +599,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v2/nats/app/app.gen.go b/examples/ping/v2/nats/app/app.gen.go index e155ac6f..85c60580 100644 --- a/examples/ping/v2/nats/app/app.gen.go +++ b/examples/ping/v2/nats/app/app.gen.go @@ -347,16 +347,19 @@ func (c *AppController) PublishPong( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -376,6 +379,7 @@ type PingMessage struct { Payload string } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -477,6 +481,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v2/nats/user/user.gen.go b/examples/ping/v2/nats/user/user.gen.go index bae2ca50..2bb5bfaf 100644 --- a/examples/ping/v2/nats/user/user.gen.go +++ b/examples/ping/v2/nats/user/user.gen.go @@ -465,16 +465,19 @@ func (c *UserController) waitForPongNextMessage( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -494,6 +497,7 @@ type PingMessage struct { Payload string } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -595,6 +599,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v3/kafka/app/app.gen.go b/examples/ping/v3/kafka/app/app.gen.go index 2970918b..fef3e5c9 100644 --- a/examples/ping/v3/kafka/app/app.gen.go +++ b/examples/ping/v3/kafka/app/app.gen.go @@ -373,16 +373,19 @@ func (c *AppController) SendAsReplyToPingRequestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -417,6 +420,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -519,6 +523,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v3/kafka/user/user.gen.go b/examples/ping/v3/kafka/user/user.gen.go index 5ffae7ac..6099a551 100644 --- a/examples/ping/v3/kafka/user/user.gen.go +++ b/examples/ping/v3/kafka/user/user.gen.go @@ -197,7 +197,6 @@ func (c *UserController) SendToPingRequestOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToPingRequestOperation( ctx context.Context, msg PingMessage, @@ -321,16 +320,19 @@ func (c *UserController) waitForPingRequestOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -365,6 +367,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -467,6 +470,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v3/nats-jetstream/app/app.gen.go b/examples/ping/v3/nats-jetstream/app/app.gen.go index 2970918b..fef3e5c9 100644 --- a/examples/ping/v3/nats-jetstream/app/app.gen.go +++ b/examples/ping/v3/nats-jetstream/app/app.gen.go @@ -373,16 +373,19 @@ func (c *AppController) SendAsReplyToPingRequestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -417,6 +420,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -519,6 +523,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v3/nats-jetstream/user/user.gen.go b/examples/ping/v3/nats-jetstream/user/user.gen.go index 5ffae7ac..6099a551 100644 --- a/examples/ping/v3/nats-jetstream/user/user.gen.go +++ b/examples/ping/v3/nats-jetstream/user/user.gen.go @@ -197,7 +197,6 @@ func (c *UserController) SendToPingRequestOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToPingRequestOperation( ctx context.Context, msg PingMessage, @@ -321,16 +320,19 @@ func (c *UserController) waitForPingRequestOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -365,6 +367,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -467,6 +470,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v3/nats/app/app.gen.go b/examples/ping/v3/nats/app/app.gen.go index 2970918b..fef3e5c9 100644 --- a/examples/ping/v3/nats/app/app.gen.go +++ b/examples/ping/v3/nats/app/app.gen.go @@ -373,16 +373,19 @@ func (c *AppController) SendAsReplyToPingRequestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -417,6 +420,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -519,6 +523,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/examples/ping/v3/nats/user/user.gen.go b/examples/ping/v3/nats/user/user.gen.go index 5ffae7ac..6099a551 100644 --- a/examples/ping/v3/nats/user/user.gen.go +++ b/examples/ping/v3/nats/user/user.gen.go @@ -197,7 +197,6 @@ func (c *UserController) SendToPingRequestOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToPingRequestOperation( ctx context.Context, msg PingMessage, @@ -321,16 +320,19 @@ func (c *UserController) waitForPingRequestOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -365,6 +367,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -467,6 +470,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/pkg/codegen/generators/v2/templates/message.tmpl b/pkg/codegen/generators/v2/templates/message.tmpl index afba07ed..664144ea 100644 --- a/pkg/codegen/generators/v2/templates/message.tmpl +++ b/pkg/codegen/generators/v2/templates/message.tmpl @@ -29,6 +29,7 @@ Headers {{template "schema-name" .Headers}} Payload {{if and .Payload.OneOf (not .Payload.ReferenceTo)}}{{namify .Payload.Name}}{{else}}{{template "schema-name" .Payload}}{{end}} } +// New{{namify .Name}} creates a new {{namify .Name}} with default values if any. func New{{namify .Name}}() {{namify .Name}} { var msg {{namify .Name}} diff --git a/pkg/codegen/generators/v2/templates/types.tmpl b/pkg/codegen/generators/v2/templates/types.tmpl index 198221bc..e8a357ff 100644 --- a/pkg/codegen/generators/v2/templates/types.tmpl +++ b/pkg/codegen/generators/v2/templates/types.tmpl @@ -1,16 +1,19 @@ // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "{{ .Info.Version }}" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/pkg/codegen/generators/v3/templates/controller.tmpl b/pkg/codegen/generators/v3/templates/controller.tmpl index 775d334c..5749316a 100644 --- a/pkg/codegen/generators/v3/templates/controller.tmpl +++ b/pkg/codegen/generators/v3/templates/controller.tmpl @@ -383,7 +383,6 @@ func (c *{{ $.Prefix }}Controller) {{ sendFuncName $value $.Prefix }}( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *{{ $.Prefix }}Controller) {{ requestFuncName $value $.Prefix }}( ctx context.Context, {{- if .Channel.Follow.Parameters}} diff --git a/pkg/codegen/generators/v3/templates/message.tmpl b/pkg/codegen/generators/v3/templates/message.tmpl index 47bfe173..669a3069 100644 --- a/pkg/codegen/generators/v3/templates/message.tmpl +++ b/pkg/codegen/generators/v3/templates/message.tmpl @@ -38,6 +38,7 @@ Headers {{template "schema-name" .Headers}} Payload {{if and .Payload.OneOf (not .Payload.ReferenceTo)}}{{namify .Payload.Name}}{{else}}{{template "schema-name" .Payload}}{{end}} } +// New{{namify .Name}} creates a new {{namify .Name}} with default values if any. func New{{namify .Name}}() {{namify .Name}} { var msg {{namify .Name}} diff --git a/pkg/codegen/generators/v3/templates/types.tmpl b/pkg/codegen/generators/v3/templates/types.tmpl index 7e921ec4..7c6b1dd7 100644 --- a/pkg/codegen/generators/v3/templates/types.tmpl +++ b/pkg/codegen/generators/v3/templates/types.tmpl @@ -1,16 +1,19 @@ // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "{{ .Info.Version }}" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v2/issues/101/asyncapi.gen.go b/test/v2/issues/101/asyncapi.gen.go index f341d58e..83cd40fb 100644 --- a/test/v2/issues/101/asyncapi.gen.go +++ b/test/v2/issues/101/asyncapi.gen.go @@ -430,16 +430,19 @@ func (c *UserController) PublishV2Issue101Test( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -450,6 +453,7 @@ type V2Issue101TestMessage struct { Payload string } +// NewV2Issue101TestMessage creates a new V2Issue101TestMessage with default values if any. func NewV2Issue101TestMessage() V2Issue101TestMessage { var msg V2Issue101TestMessage diff --git a/test/v2/issues/114/asyncapi.gen.go b/test/v2/issues/114/asyncapi.gen.go index d1eeff24..d7bd8100 100644 --- a/test/v2/issues/114/asyncapi.gen.go +++ b/test/v2/issues/114/asyncapi.gen.go @@ -12,16 +12,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -32,6 +35,7 @@ type V2Issue114StatusMessage struct { Payload string } +// NewV2Issue114StatusMessage creates a new V2Issue114StatusMessage with default values if any. func NewV2Issue114StatusMessage() V2Issue114StatusMessage { var msg V2Issue114StatusMessage diff --git a/test/v2/issues/122/asyncapi.gen.go b/test/v2/issues/122/asyncapi.gen.go index b7e73b9b..79fe3c86 100644 --- a/test/v2/issues/122/asyncapi.gen.go +++ b/test/v2/issues/122/asyncapi.gen.go @@ -430,16 +430,19 @@ func (c *UserController) PublishV2Issue122Msg( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -450,6 +453,7 @@ type V2Issue122MsgMessage struct { Payload string } +// NewV2Issue122MsgMessage creates a new V2Issue122MsgMessage with default values if any. func NewV2Issue122MsgMessage() V2Issue122MsgMessage { var msg V2Issue122MsgMessage diff --git a/test/v2/issues/129/camel/asyncapi.gen.go b/test/v2/issues/129/camel/asyncapi.gen.go index 7cfdca45..d332c2ba 100644 --- a/test/v2/issues/129/camel/asyncapi.gen.go +++ b/test/v2/issues/129/camel/asyncapi.gen.go @@ -180,16 +180,19 @@ func (c *UserController) PublishV2Issue129Test( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -200,6 +203,7 @@ type V2Issue129TestMessage struct { Payload TestSchema } +// NewV2Issue129TestMessage creates a new V2Issue129TestMessage with default values if any. func NewV2Issue129TestMessage() V2Issue129TestMessage { var msg V2Issue129TestMessage diff --git a/test/v2/issues/129/kebab/asyncapi.gen.go b/test/v2/issues/129/kebab/asyncapi.gen.go index 3765e779..4460c801 100644 --- a/test/v2/issues/129/kebab/asyncapi.gen.go +++ b/test/v2/issues/129/kebab/asyncapi.gen.go @@ -180,16 +180,19 @@ func (c *UserController) PublishV2Issue129Test( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -200,6 +203,7 @@ type V2Issue129TestMessage struct { Payload TestSchema } +// NewV2Issue129TestMessage creates a new V2Issue129TestMessage with default values if any. func NewV2Issue129TestMessage() V2Issue129TestMessage { var msg V2Issue129TestMessage diff --git a/test/v2/issues/129/none/asyncapi.gen.go b/test/v2/issues/129/none/asyncapi.gen.go index 69d26b23..5fae840b 100644 --- a/test/v2/issues/129/none/asyncapi.gen.go +++ b/test/v2/issues/129/none/asyncapi.gen.go @@ -180,16 +180,19 @@ func (c *UserController) PublishV2Issue129Test( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -200,6 +203,7 @@ type V2Issue129TestMessage struct { Payload TestSchema } +// NewV2Issue129TestMessage creates a new V2Issue129TestMessage with default values if any. func NewV2Issue129TestMessage() V2Issue129TestMessage { var msg V2Issue129TestMessage diff --git a/test/v2/issues/129/snake/asyncapi.gen.go b/test/v2/issues/129/snake/asyncapi.gen.go index 77992400..a175215a 100644 --- a/test/v2/issues/129/snake/asyncapi.gen.go +++ b/test/v2/issues/129/snake/asyncapi.gen.go @@ -180,16 +180,19 @@ func (c *UserController) PublishV2Issue129Test( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -200,6 +203,7 @@ type V2Issue129TestMessage struct { Payload TestSchema } +// NewV2Issue129TestMessage creates a new V2Issue129TestMessage with default values if any. func NewV2Issue129TestMessage() V2Issue129TestMessage { var msg V2Issue129TestMessage diff --git a/test/v2/issues/131/asyncapi.gen.go b/test/v2/issues/131/asyncapi.gen.go index e7ff7aac..347c71a9 100644 --- a/test/v2/issues/131/asyncapi.gen.go +++ b/test/v2/issues/131/asyncapi.gen.go @@ -431,16 +431,19 @@ func (c *UserController) UnsubscribeV2Issue131Test(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -451,6 +454,7 @@ type V2Issue131TestMessage struct { Payload TestSchema } +// NewV2Issue131TestMessage creates a new V2Issue131TestMessage with default values if any. func NewV2Issue131TestMessage() V2Issue131TestMessage { var msg V2Issue131TestMessage diff --git a/test/v2/issues/135/asyncapi.gen.go b/test/v2/issues/135/asyncapi.gen.go index c2aa50c2..c44d7327 100644 --- a/test/v2/issues/135/asyncapi.gen.go +++ b/test/v2/issues/135/asyncapi.gen.go @@ -12,16 +12,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -32,6 +35,7 @@ type V2Issue135GroupMessage struct { Payload string } +// NewV2Issue135GroupMessage creates a new V2Issue135GroupMessage with default values if any. func NewV2Issue135GroupMessage() V2Issue135GroupMessage { var msg V2Issue135GroupMessage @@ -73,6 +77,7 @@ type V2Issue135InfoMessage struct { Payload string } +// NewV2Issue135InfoMessage creates a new V2Issue135InfoMessage with default values if any. func NewV2Issue135InfoMessage() V2Issue135InfoMessage { var msg V2Issue135InfoMessage @@ -114,6 +119,7 @@ type V2Issue135ProjectMessage struct { Payload string } +// NewV2Issue135ProjectMessage creates a new V2Issue135ProjectMessage with default values if any. func NewV2Issue135ProjectMessage() V2Issue135ProjectMessage { var msg V2Issue135ProjectMessage @@ -155,6 +161,7 @@ type V2Issue135ResourceMessage struct { Payload string } +// NewV2Issue135ResourceMessage creates a new V2Issue135ResourceMessage with default values if any. func NewV2Issue135ResourceMessage() V2Issue135ResourceMessage { var msg V2Issue135ResourceMessage @@ -196,6 +203,7 @@ type V2Issue135StatusMessage struct { Payload string } +// NewV2Issue135StatusMessage creates a new V2Issue135StatusMessage with default values if any. func NewV2Issue135StatusMessage() V2Issue135StatusMessage { var msg V2Issue135StatusMessage diff --git a/test/v2/issues/137/asyncapi.gen.go b/test/v2/issues/137/asyncapi.gen.go index f5e11ab3..d6534d9f 100644 --- a/test/v2/issues/137/asyncapi.gen.go +++ b/test/v2/issues/137/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v2/issues/164/asyncapi.gen.go b/test/v2/issues/164/asyncapi.gen.go index c07f60ec..c443d773 100644 --- a/test/v2/issues/164/asyncapi.gen.go +++ b/test/v2/issues/164/asyncapi.gen.go @@ -431,16 +431,19 @@ func (c *UserController) PublishV2Issue164TestMap( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -451,6 +454,7 @@ type TestMapMessage struct { Payload TestMapSchema } +// NewTestMapMessage creates a new TestMapMessage with default values if any. func NewTestMapMessage() TestMapMessage { var msg TestMapMessage diff --git a/test/v2/issues/169/asyncapi.gen.go b/test/v2/issues/169/asyncapi.gen.go index 60acfc2a..a22c8261 100644 --- a/test/v2/issues/169/asyncapi.gen.go +++ b/test/v2/issues/169/asyncapi.gen.go @@ -430,16 +430,19 @@ func (c *UserController) PublishV2Issue169Msg( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -450,6 +453,7 @@ type V2Issue169MsgMessage struct { Payload string } +// NewV2Issue169MsgMessage creates a new V2Issue169MsgMessage with default values if any. func NewV2Issue169MsgMessage() V2Issue169MsgMessage { var msg V2Issue169MsgMessage diff --git a/test/v2/issues/185/asyncapi.gen.go b/test/v2/issues/185/asyncapi.gen.go index c9f5eaa1..83ce79b9 100644 --- a/test/v2/issues/185/asyncapi.gen.go +++ b/test/v2/issues/185/asyncapi.gen.go @@ -11,16 +11,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v2/issues/186/asyncapi.gen.go b/test/v2/issues/186/asyncapi.gen.go index cd137dce..88121a1d 100644 --- a/test/v2/issues/186/asyncapi.gen.go +++ b/test/v2/issues/186/asyncapi.gen.go @@ -589,16 +589,19 @@ func (c *UserController) PublishV2Issue186Star( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -609,6 +612,7 @@ type V2Issue186AngleMessage struct { Payload string } +// NewV2Issue186AngleMessage creates a new V2Issue186AngleMessage with default values if any. func NewV2Issue186AngleMessage() V2Issue186AngleMessage { var msg V2Issue186AngleMessage @@ -650,6 +654,7 @@ type V2Issue186StarMessage struct { Payload string } +// NewV2Issue186StarMessage creates a new V2Issue186StarMessage with default values if any. func NewV2Issue186StarMessage() V2Issue186StarMessage { var msg V2Issue186StarMessage diff --git a/test/v2/issues/190/asyncapi.gen.go b/test/v2/issues/190/asyncapi.gen.go index 3181702d..a19b306b 100644 --- a/test/v2/issues/190/asyncapi.gen.go +++ b/test/v2/issues/190/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -44,6 +47,7 @@ type V2Issue190Msg1Message struct { Payload V2Issue190Msg1MessagePayload } +// NewV2Issue190Msg1Message creates a new V2Issue190Msg1Message with default values if any. func NewV2Issue190Msg1Message() V2Issue190Msg1Message { var msg V2Issue190Msg1Message @@ -101,6 +105,7 @@ type V2Issue190Msg2Message struct { Payload V2Issue190Msg2MessagePayload } +// NewV2Issue190Msg2Message creates a new V2Issue190Msg2Message with default values if any. func NewV2Issue190Msg2Message() V2Issue190Msg2Message { var msg V2Issue190Msg2Message diff --git a/test/v2/issues/192/asyncapi.gen.go b/test/v2/issues/192/asyncapi.gen.go index 0623e408..43ccf117 100644 --- a/test/v2/issues/192/asyncapi.gen.go +++ b/test/v2/issues/192/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v2/issues/214/asyncapi.gen.go b/test/v2/issues/214/asyncapi.gen.go index aa8558b0..5a55520a 100644 --- a/test/v2/issues/214/asyncapi.gen.go +++ b/test/v2/issues/214/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -33,6 +36,7 @@ type TestMessageMessage struct { Payload Event } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v2/issues/215/asyncapi.gen.go b/test/v2/issues/215/asyncapi.gen.go index 790abaf7..bfffd76e 100644 --- a/test/v2/issues/215/asyncapi.gen.go +++ b/test/v2/issues/215/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -38,6 +41,7 @@ type TestMessageMessage struct { Payload TestMessageMessagePayload } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v2/issues/216/asyncapi.gen.go b/test/v2/issues/216/asyncapi.gen.go index 393cbbb4..2cd66934 100644 --- a/test/v2/issues/216/asyncapi.gen.go +++ b/test/v2/issues/216/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -47,6 +50,7 @@ type EventSuccessMessage struct { Payload EventSuccessMessagePayload } +// NewEventSuccessMessage creates a new EventSuccessMessage with default values if any. func NewEventSuccessMessage() EventSuccessMessage { var msg EventSuccessMessage diff --git a/test/v2/issues/220/camel/asyncapi.gen.go b/test/v2/issues/220/camel/asyncapi.gen.go index dc57edab..d8b3c897 100644 --- a/test/v2/issues/220/camel/asyncapi.gen.go +++ b/test/v2/issues/220/camel/asyncapi.gen.go @@ -431,16 +431,19 @@ func (c *UserController) UnsubscribeV2Issue220Test(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -451,6 +454,7 @@ type V2Issue220TestMessage struct { Payload TestSchema } +// NewV2Issue220TestMessage creates a new V2Issue220TestMessage with default values if any. func NewV2Issue220TestMessage() V2Issue220TestMessage { var msg V2Issue220TestMessage diff --git a/test/v2/issues/220/none/asyncapi.gen.go b/test/v2/issues/220/none/asyncapi.gen.go index 697ddfc4..019390e6 100644 --- a/test/v2/issues/220/none/asyncapi.gen.go +++ b/test/v2/issues/220/none/asyncapi.gen.go @@ -431,16 +431,19 @@ func (c *UserController) UnsubscribeV2Issue220Test(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -451,6 +454,7 @@ type V2Issue220TestMessage struct { Payload TESTSchema } +// NewV2Issue220TestMessage creates a new V2Issue220TestMessage with default values if any. func NewV2Issue220TestMessage() V2Issue220TestMessage { var msg V2Issue220TestMessage diff --git a/test/v2/issues/222/asyncapi.gen.go b/test/v2/issues/222/asyncapi.gen.go index b296a341..f91eb230 100644 --- a/test/v2/issues/222/asyncapi.gen.go +++ b/test/v2/issues/222/asyncapi.gen.go @@ -434,16 +434,19 @@ func (c *UserController) UnsubscribeV2Issue222Test(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -454,6 +457,7 @@ type V2Issue222TestMessage struct { Payload TestSchema } +// NewV2Issue222TestMessage creates a new V2Issue222TestMessage with default values if any. func NewV2Issue222TestMessage() V2Issue222TestMessage { var msg V2Issue222TestMessage diff --git a/test/v2/issues/233/asyncapi.gen.go b/test/v2/issues/233/asyncapi.gen.go index 5a9dbaa2..9d2a78e2 100644 --- a/test/v2/issues/233/asyncapi.gen.go +++ b/test/v2/issues/233/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -33,6 +36,7 @@ type TestMessageMessage struct { Payload time.Time } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v2/issues/245/asyncapi.gen.go b/test/v2/issues/245/asyncapi.gen.go index b3723d6f..67f3a54a 100644 --- a/test/v2/issues/245/asyncapi.gen.go +++ b/test/v2/issues/245/asyncapi.gen.go @@ -431,16 +431,19 @@ func (c *UserController) UnsubscribeV2Issue245Test(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -451,6 +454,7 @@ type V2Issue245TestMessage struct { Payload TestSchema } +// NewV2Issue245TestMessage creates a new V2Issue245TestMessage with default values if any. func NewV2Issue245TestMessage() V2Issue245TestMessage { var msg V2Issue245TestMessage diff --git a/test/v2/issues/255/default/asyncapi.gen.go b/test/v2/issues/255/default/asyncapi.gen.go index 594db2f0..815b310b 100644 --- a/test/v2/issues/255/default/asyncapi.gen.go +++ b/test/v2/issues/255/default/asyncapi.gen.go @@ -254,16 +254,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -280,6 +283,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v2/issues/255/ignoredates/asyncapi.gen.go b/test/v2/issues/255/ignoredates/asyncapi.gen.go index 498f0182..599f0c8f 100644 --- a/test/v2/issues/255/ignoredates/asyncapi.gen.go +++ b/test/v2/issues/255/ignoredates/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -277,6 +280,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v2/issues/258/asyncapi.gen.go b/test/v2/issues/258/asyncapi.gen.go index 4620e617..747c7bc4 100644 --- a/test/v2/issues/258/asyncapi.gen.go +++ b/test/v2/issues/258/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -74,6 +77,7 @@ type TestMessageMessage struct { Payload TestMessageMessagePayload } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v2/issues/259/default/asyncapi.gen.go b/test/v2/issues/259/default/asyncapi.gen.go index b239281b..3fb505f4 100644 --- a/test/v2/issues/259/default/asyncapi.gen.go +++ b/test/v2/issues/259/default/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -279,6 +282,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v2/issues/259/forcepointers/asyncapi.gen.go b/test/v2/issues/259/forcepointers/asyncapi.gen.go index 52430831..c4219fc5 100644 --- a/test/v2/issues/259/forcepointers/asyncapi.gen.go +++ b/test/v2/issues/259/forcepointers/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -279,6 +282,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v2/issues/261/asyncapi.gen.go b/test/v2/issues/261/asyncapi.gen.go index 99a6137e..ae41cd00 100644 --- a/test/v2/issues/261/asyncapi.gen.go +++ b/test/v2/issues/261/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -33,6 +36,7 @@ type TestMessageMessage struct { Payload FreeFormSchema } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v2/issues/262/asyncapi.gen.go b/test/v2/issues/262/asyncapi.gen.go index c0a8e7fb..a1179e1d 100644 --- a/test/v2/issues/262/asyncapi.gen.go +++ b/test/v2/issues/262/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -281,6 +284,7 @@ type TestMessage struct { Payload string } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v2/issues/267/asyncapi.gen.go b/test/v2/issues/267/asyncapi.gen.go index ac1fbd19..1e6216a9 100644 --- a/test/v2/issues/267/asyncapi.gen.go +++ b/test/v2/issues/267/asyncapi.gen.go @@ -431,16 +431,19 @@ func (c *UserController) UnsubscribeV2Issue267Test(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -451,6 +454,7 @@ type V2Issue267TestMessage struct { Payload TestSchema } +// NewV2Issue267TestMessage creates a new V2Issue267TestMessage with default values if any. func NewV2Issue267TestMessage() V2Issue267TestMessage { var msg V2Issue267TestMessage diff --git a/test/v2/issues/275/asyncapi.gen.go b/test/v2/issues/275/asyncapi.gen.go index 8ecaa8f3..78cc4874 100644 --- a/test/v2/issues/275/asyncapi.gen.go +++ b/test/v2/issues/275/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -33,6 +36,7 @@ type V2OmitemptyTestMessage struct { Payload TestSchema } +// NewV2OmitemptyTestMessage creates a new V2OmitemptyTestMessage with default values if any. func NewV2OmitemptyTestMessage() V2OmitemptyTestMessage { var msg V2OmitemptyTestMessage diff --git a/test/v2/issues/290/asyncapi.gen.go b/test/v2/issues/290/asyncapi.gen.go index 7620dab1..f0532f90 100644 --- a/test/v2/issues/290/asyncapi.gen.go +++ b/test/v2/issues/290/asyncapi.gen.go @@ -431,16 +431,19 @@ func (c *UserController) UnsubscribeTestCreated(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -451,6 +454,7 @@ type TestCreatedMessage struct { Payload TestEventSchema } +// NewTestCreatedMessage creates a new TestCreatedMessage with default values if any. func NewTestCreatedMessage() TestCreatedMessage { var msg TestCreatedMessage diff --git a/test/v2/issues/49/asyncapi.gen.go b/test/v2/issues/49/asyncapi.gen.go index 6f7c987b..6630c663 100644 --- a/test/v2/issues/49/asyncapi.gen.go +++ b/test/v2/issues/49/asyncapi.gen.go @@ -769,16 +769,19 @@ func (c *UserController) PublishV2Issue49Chat( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -789,6 +792,7 @@ type V2Issue49ChatSubscribeMessage struct { Payload string } +// NewV2Issue49ChatSubscribeMessage creates a new V2Issue49ChatSubscribeMessage with default values if any. func NewV2Issue49ChatSubscribeMessage() V2Issue49ChatSubscribeMessage { var msg V2Issue49ChatSubscribeMessage @@ -830,6 +834,7 @@ type V2Issue49ChatPublishMessage struct { Payload string } +// NewV2Issue49ChatPublishMessage creates a new V2Issue49ChatPublishMessage with default values if any. func NewV2Issue49ChatPublishMessage() V2Issue49ChatPublishMessage { var msg V2Issue49ChatPublishMessage @@ -871,6 +876,7 @@ type V2Issue49StatusMessage struct { Payload string } +// NewV2Issue49StatusMessage creates a new V2Issue49StatusMessage with default values if any. func NewV2Issue49StatusMessage() V2Issue49StatusMessage { var msg V2Issue49StatusMessage diff --git a/test/v2/issues/73/v1/asyncapi.gen.go b/test/v2/issues/73/v1/asyncapi.gen.go index 5a776056..2e57e1ec 100644 --- a/test/v2/issues/73/v1/asyncapi.gen.go +++ b/test/v2/issues/73/v1/asyncapi.gen.go @@ -430,16 +430,19 @@ func (c *UserController) PublishV2Issue73Hello( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -450,6 +453,7 @@ type V2Issue73HelloMessage struct { Payload string } +// NewV2Issue73HelloMessage creates a new V2Issue73HelloMessage with default values if any. func NewV2Issue73HelloMessage() V2Issue73HelloMessage { var msg V2Issue73HelloMessage diff --git a/test/v2/issues/73/v2/asyncapi.gen.go b/test/v2/issues/73/v2/asyncapi.gen.go index 87564d7f..f96debc2 100644 --- a/test/v2/issues/73/v2/asyncapi.gen.go +++ b/test/v2/issues/73/v2/asyncapi.gen.go @@ -432,16 +432,19 @@ func (c *UserController) PublishV2Issue73Hello( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "2.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -458,6 +461,7 @@ type V2Issue73HelloMessage struct { Payload V2Issue73HelloMessagePayload } +// NewV2Issue73HelloMessage creates a new V2Issue73HelloMessage with default values if any. func NewV2Issue73HelloMessage() V2Issue73HelloMessage { var msg V2Issue73HelloMessage diff --git a/test/v2/issues/74/asyncapi.gen.go b/test/v2/issues/74/asyncapi.gen.go index 77dee93d..f18aeb9f 100644 --- a/test/v2/issues/74/asyncapi.gen.go +++ b/test/v2/issues/74/asyncapi.gen.go @@ -432,16 +432,19 @@ func (c *UserController) PublishV2Issue74TestChannel( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -461,6 +464,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v2/issues/97/asyncapi.gen.go b/test/v2/issues/97/asyncapi.gen.go index 6e306cec..f612a0fa 100644 --- a/test/v2/issues/97/asyncapi.gen.go +++ b/test/v2/issues/97/asyncapi.gen.go @@ -749,16 +749,19 @@ func (c *UserController) UnsubscribeV2Issue97ReferencePayloadString(ctx context. // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -769,6 +772,7 @@ type ReferencePayloadArrayMessage struct { Payload ArraySchema } +// NewReferencePayloadArrayMessage creates a new ReferencePayloadArrayMessage with default values if any. func NewReferencePayloadArrayMessage() ReferencePayloadArrayMessage { var msg ReferencePayloadArrayMessage @@ -815,6 +819,7 @@ type ReferencePayloadObjectMessage struct { Payload ObjectSchema } +// NewReferencePayloadObjectMessage creates a new ReferencePayloadObjectMessage with default values if any. func NewReferencePayloadObjectMessage() ReferencePayloadObjectMessage { var msg ReferencePayloadObjectMessage @@ -861,6 +866,7 @@ type ReferencePayloadStringMessage struct { Payload StringSchema } +// NewReferencePayloadStringMessage creates a new ReferencePayloadStringMessage with default values if any. func NewReferencePayloadStringMessage() ReferencePayloadStringMessage { var msg ReferencePayloadStringMessage diff --git a/test/v2/issues/99/asyncapi.gen.go b/test/v2/issues/99/asyncapi.gen.go index 7014960f..443c01ef 100644 --- a/test/v2/issues/99/asyncapi.gen.go +++ b/test/v2/issues/99/asyncapi.gen.go @@ -430,16 +430,19 @@ func (c *UserController) PublishV2Issue99Test( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -450,6 +453,7 @@ type V2Issue99TestMessage struct { Payload string } +// NewV2Issue99TestMessage creates a new V2Issue99TestMessage with default values if any. func NewV2Issue99TestMessage() V2Issue99TestMessage { var msg V2Issue99TestMessage diff --git a/test/v3/issues/129/camel/asyncapi.gen.go b/test/v3/issues/129/camel/asyncapi.gen.go index dd0d5c17..92f8724d 100644 --- a/test/v3/issues/129/camel/asyncapi.gen.go +++ b/test/v3/issues/129/camel/asyncapi.gen.go @@ -183,16 +183,19 @@ func (c *UserController) SendToReceiveTestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -203,6 +206,7 @@ type TestMessageFromTestChannel struct { Payload TestSchema } +// NewTestMessageFromTestChannel creates a new TestMessageFromTestChannel with default values if any. func NewTestMessageFromTestChannel() TestMessageFromTestChannel { var msg TestMessageFromTestChannel diff --git a/test/v3/issues/129/kebab/asyncapi.gen.go b/test/v3/issues/129/kebab/asyncapi.gen.go index 1bca4691..477b8a24 100644 --- a/test/v3/issues/129/kebab/asyncapi.gen.go +++ b/test/v3/issues/129/kebab/asyncapi.gen.go @@ -183,16 +183,19 @@ func (c *UserController) SendToReceiveTestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -203,6 +206,7 @@ type TestMessageFromTestChannel struct { Payload TestSchema } +// NewTestMessageFromTestChannel creates a new TestMessageFromTestChannel with default values if any. func NewTestMessageFromTestChannel() TestMessageFromTestChannel { var msg TestMessageFromTestChannel diff --git a/test/v3/issues/129/none/asyncapi.gen.go b/test/v3/issues/129/none/asyncapi.gen.go index 9144991e..92daf655 100644 --- a/test/v3/issues/129/none/asyncapi.gen.go +++ b/test/v3/issues/129/none/asyncapi.gen.go @@ -183,16 +183,19 @@ func (c *UserController) SendToReceiveTestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -203,6 +206,7 @@ type TestMessageFromTestChannel struct { Payload TestSchema } +// NewTestMessageFromTestChannel creates a new TestMessageFromTestChannel with default values if any. func NewTestMessageFromTestChannel() TestMessageFromTestChannel { var msg TestMessageFromTestChannel diff --git a/test/v3/issues/129/snake/asyncapi.gen.go b/test/v3/issues/129/snake/asyncapi.gen.go index 25ca93c9..90f8fb21 100644 --- a/test/v3/issues/129/snake/asyncapi.gen.go +++ b/test/v3/issues/129/snake/asyncapi.gen.go @@ -183,16 +183,19 @@ func (c *UserController) SendToReceiveTestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -203,6 +206,7 @@ type TestMessageFromTestChannel struct { Payload TestSchema } +// NewTestMessageFromTestChannel creates a new TestMessageFromTestChannel with default values if any. func NewTestMessageFromTestChannel() TestMessageFromTestChannel { var msg TestMessageFromTestChannel diff --git a/test/v3/issues/130/decoupling/asyncapi.gen.go b/test/v3/issues/130/decoupling/asyncapi.gen.go index bd5d45c4..d17b211d 100644 --- a/test/v3/issues/130/decoupling/asyncapi.gen.go +++ b/test/v3/issues/130/decoupling/asyncapi.gen.go @@ -442,16 +442,19 @@ func (c *UserController) SendToConsumeUserSignupOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -468,6 +471,7 @@ type UserMessageFromUserSignupChannel struct { Payload UserMessageFromUserSignupChannelPayload } +// NewUserMessageFromUserSignupChannel creates a new UserMessageFromUserSignupChannel with default values if any. func NewUserMessageFromUserSignupChannel() UserMessageFromUserSignupChannel { var msg UserMessageFromUserSignupChannel diff --git a/test/v3/issues/130/parameters/asyncapi.gen.go b/test/v3/issues/130/parameters/asyncapi.gen.go index aede539b..99e1b436 100644 --- a/test/v3/issues/130/parameters/asyncapi.gen.go +++ b/test/v3/issues/130/parameters/asyncapi.gen.go @@ -440,16 +440,19 @@ func (c *UserController) SendToReceiveUserSignedUpOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -471,6 +474,7 @@ type UserMessageFromUserSignupChannel struct { Payload UserMessageFromUserSignupChannelPayload } +// NewUserMessageFromUserSignupChannel creates a new UserMessageFromUserSignupChannel with default values if any. func NewUserMessageFromUserSignupChannel() UserMessageFromUserSignupChannel { var msg UserMessageFromUserSignupChannel diff --git a/test/v3/issues/130/requestreply/asyncapi.gen.go b/test/v3/issues/130/requestreply/asyncapi.gen.go index 9a0a9514..07f161f3 100644 --- a/test/v3/issues/130/requestreply/asyncapi.gen.go +++ b/test/v3/issues/130/requestreply/asyncapi.gen.go @@ -686,7 +686,6 @@ func (c *UserController) SendToPingOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToPingOperation( ctx context.Context, msg PingMessage, @@ -834,7 +833,6 @@ func (c *UserController) SendToPingWithIDOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToPingWithIDOperation( ctx context.Context, msg PingWithIDMessage, @@ -958,16 +956,19 @@ func (c *UserController) waitForPingWithIDOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -1003,6 +1004,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -1063,6 +1065,7 @@ type PingWithIDMessage struct { Payload PingWithIDMessagePayload } +// NewPingWithIDMessage creates a new PingWithIDMessage with default values if any. func NewPingWithIDMessage() PingWithIDMessage { var msg PingWithIDMessage @@ -1156,6 +1159,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage @@ -1216,6 +1220,7 @@ type PongWithIDMessage struct { Payload PongWithIDMessagePayload } +// NewPongWithIDMessage creates a new PongWithIDMessage with default values if any. func NewPongWithIDMessage() PongWithIDMessage { var msg PongWithIDMessage diff --git a/test/v3/issues/131/asyncapi.gen.go b/test/v3/issues/131/asyncapi.gen.go index 0e8e2719..a13af95f 100644 --- a/test/v3/issues/131/asyncapi.gen.go +++ b/test/v3/issues/131/asyncapi.gen.go @@ -442,16 +442,19 @@ func (c *UserController) SendToReceiveTestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -462,6 +465,7 @@ type TestMessageFromTestChannel struct { Payload TestSchema } +// NewTestMessageFromTestChannel creates a new TestMessageFromTestChannel with default values if any. func NewTestMessageFromTestChannel() TestMessageFromTestChannel { var msg TestMessageFromTestChannel diff --git a/test/v3/issues/135/asyncapi.gen.go b/test/v3/issues/135/asyncapi.gen.go index b78a0fa9..45aace4a 100644 --- a/test/v3/issues/135/asyncapi.gen.go +++ b/test/v3/issues/135/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/137/asyncapi.gen.go b/test/v3/issues/137/asyncapi.gen.go index f5e11ab3..d6534d9f 100644 --- a/test/v3/issues/137/asyncapi.gen.go +++ b/test/v3/issues/137/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/138/asyncapi.gen.go b/test/v3/issues/138/asyncapi.gen.go index c7cd2649..98a7e9dd 100644 --- a/test/v3/issues/138/asyncapi.gen.go +++ b/test/v3/issues/138/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/139/asyncapi.gen.go b/test/v3/issues/139/asyncapi.gen.go index 8b7ac834..dcd80659 100644 --- a/test/v3/issues/139/asyncapi.gen.go +++ b/test/v3/issues/139/asyncapi.gen.go @@ -446,16 +446,19 @@ func (c *UserController) UnsubscribeFromSendUserOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -483,6 +486,7 @@ type UserSignedUpMessage struct { Payload UserSignedUpMessagePayload } +// NewUserSignedUpMessage creates a new UserSignedUpMessage with default values if any. func NewUserSignedUpMessage() UserSignedUpMessage { var msg UserSignedUpMessage diff --git a/test/v3/issues/141/asyncapi.gen.go b/test/v3/issues/141/asyncapi.gen.go new file mode 100644 index 00000000..644cfb8c --- /dev/null +++ b/test/v3/issues/141/asyncapi.gen.go @@ -0,0 +1,881 @@ +// Package "issue141" provides primitives to interact with the AsyncAPI specification. +// +// Code generated by github.com/lerenn/asyncapi-codegen version (devel) DO NOT EDIT. +package issue141 + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/lerenn/asyncapi-codegen/pkg/extensions" + + "github.com/google/uuid" +) + +// controller is the controller that will be used to communicate with the broker +// It will be used internally by AppController and UserController +type controller struct { + // broker is the broker controller that will be used to communicate + broker extensions.BrokerController + // subscriptions is a map of all subscriptions + subscriptions map[string]extensions.BrokerChannelSubscription + // logger is the logger that will be used to log operations on controller + logger extensions.Logger + // middlewares are the middlewares that will be executed when sending or + // receiving messages + middlewares []extensions.Middleware + // handler to handle errors from consumers and middlewares + errorHandler extensions.ErrorHandler +} + +// ControllerOption is the type of the options that can be passed +// when creating a new Controller +type ControllerOption func(controller *controller) + +// WithLogger attaches a logger to the controller +func WithLogger(logger extensions.Logger) ControllerOption { + return func(controller *controller) { + controller.logger = logger + } +} + +// WithMiddlewares attaches middlewares that will be executed when sending or receiving messages +func WithMiddlewares(middlewares ...extensions.Middleware) ControllerOption { + return func(controller *controller) { + controller.middlewares = middlewares + } +} + +// WithErrorHandler attaches a errorhandler to handle errors from subscriber functions +func WithErrorHandler(handler extensions.ErrorHandler) ControllerOption { + return func(controller *controller) { + controller.errorHandler = handler + } +} + +// AppSubscriber contains all handlers that are listening messages for App +type AppSubscriber interface { + // PingOperationReceived receive all Ping messages from Ping channel. + PingOperationReceived(ctx context.Context, msg PingMessage) error +} + +// AppController is the structure that provides sending capabilities to the +// developer and and connect the broker with the App +type AppController struct { + controller +} + +// NewAppController links the App to the broker +func NewAppController(bc extensions.BrokerController, options ...ControllerOption) (*AppController, error) { + // Check if broker controller has been provided + if bc == nil { + return nil, extensions.ErrNilBrokerController + } + + // Create default controller + controller := controller{ + broker: bc, + subscriptions: make(map[string]extensions.BrokerChannelSubscription), + logger: extensions.DummyLogger{}, + middlewares: make([]extensions.Middleware, 0), + errorHandler: extensions.DefaultErrorHandler(), + } + + // Apply options + for _, option := range options { + option(&controller) + } + + return &AppController{controller: controller}, nil +} + +func (c AppController) wrapMiddlewares( + middlewares []extensions.Middleware, + callback extensions.NextMiddleware, +) func(ctx context.Context, msg *extensions.BrokerMessage) error { + var called bool + + // If there is no more middleware + if len(middlewares) == 0 { + return func(ctx context.Context, msg *extensions.BrokerMessage) error { + // Call the callback if it exists and it has not been called already + if callback != nil && !called { + called = true + return callback(ctx) + } + + // Nil can be returned, as the callback has already been called + return nil + } + } + + // Get the next function to call from next middlewares or callback + next := c.wrapMiddlewares(middlewares[1:], callback) + + // Wrap middleware into a check function that will call execute the middleware + // and call the next wrapped middleware if the returned function has not been + // called already + return func(ctx context.Context, msg *extensions.BrokerMessage) error { + // Call the middleware and the following if it has not been done already + if !called { + // Create the next call with the context and the message + nextWithArgs := func(ctx context.Context) error { + return next(ctx, msg) + } + + // Call the middleware and register it as already called + called = true + if err := middlewares[0](ctx, msg, nextWithArgs); err != nil { + return err + } + + // If next has already been called in middleware, it should not be executed again + return nextWithArgs(ctx) + } + + // Nil can be returned, as the next middleware has already been called + return nil + } +} + +func (c AppController) executeMiddlewares(ctx context.Context, msg *extensions.BrokerMessage, callback extensions.NextMiddleware) error { + // Wrap middleware to have 'next' function when calling them + wrapped := c.wrapMiddlewares(c.middlewares, callback) + + // Execute wrapped middlewares + return wrapped(ctx, msg) +} + +func addAppContextValues(ctx context.Context, addr string) context.Context { + ctx = context.WithValue(ctx, extensions.ContextKeyIsVersion, "1.0.0") + ctx = context.WithValue(ctx, extensions.ContextKeyIsProvider, "app") + return context.WithValue(ctx, extensions.ContextKeyIsChannel, addr) +} + +// Close will clean up any existing resources on the controller +func (c *AppController) Close(ctx context.Context) { + // Unsubscribing remaining channels + c.UnsubscribeFromAllChannels(ctx) + + c.logger.Info(ctx, "Closed app controller") +} + +// SubscribeToAllChannels will receive messages from channels where channel has +// no parameter on which the app is expecting messages. For channels with parameters, +// they should be subscribed independently. +func (c *AppController) SubscribeToAllChannels(ctx context.Context, as AppSubscriber) error { + if as == nil { + return extensions.ErrNilAppSubscriber + } + + if err := c.SubscribeToPingOperation(ctx, as.PingOperationReceived); err != nil { + return err + } + + return nil +} + +// UnsubscribeFromAllChannels will stop the subscription of all remaining subscribed channels +func (c *AppController) UnsubscribeFromAllChannels(ctx context.Context) { + c.UnsubscribeFromPingOperation(ctx) +} + +// SubscribeToPingOperation will receive Ping messages from Ping channel. +// +// Callback function 'fn' will be called each time a new message is received. +// +// NOTE: for now, this only support the first message from AsyncAPI list. +// +// NOTE: for now, this only support the first message from AsyncAPI list. +// If you need support for other messages, please raise an issue. +func (c *AppController) SubscribeToPingOperation( + ctx context.Context, + fn func(ctx context.Context, msg PingMessage) error, +) error { + // Get channel address + addr := "v3.issue141.ping" + + // Set context + ctx = addAppContextValues(ctx, addr) + ctx = context.WithValue(ctx, extensions.ContextKeyIsDirection, "reception") + + // Check if the controller is already subscribed + _, exists := c.subscriptions[addr] + if exists { + err := fmt.Errorf("%w: controller is already subscribed on channel %q", extensions.ErrAlreadySubscribedChannel, addr) + c.logger.Error(ctx, err.Error()) + return err + } + + // Subscribe to broker channel + sub, err := c.broker.Subscribe(ctx, addr) + if err != nil { + c.logger.Error(ctx, err.Error()) + return err + } + c.logger.Info(ctx, "Subscribed to channel") + + // Asynchronously listen to new messages and pass them to app receiver + go func() { + for { + // Listen to next message + stop, err := c.listenToPingOperationNextMessage(addr, sub, fn) + if err != nil { + c.logger.Error(ctx, err.Error()) + } + + // Stop if required + if stop { + return + } + } + }() + + // Add the cancel channel to the inside map + c.subscriptions[addr] = sub + + return nil +} + +func (c *AppController) listenToPingOperationNextMessage( + addr string, + sub extensions.BrokerChannelSubscription, + fn func(ctx context.Context, msg PingMessage) error, +) (stop bool, err error) { + // Create a context for the received response + msgCtx, cancel := context.WithCancel(context.Background()) + msgCtx = addAppContextValues(msgCtx, addr) + msgCtx = context.WithValue(msgCtx, extensions.ContextKeyIsDirection, "reception") + defer cancel() + + // Wait for next message + acknowledgeableBrokerMessage, open := <-sub.MessagesChannel() + + // If subscription is closed and there is no more message + // (i.e. uninitialized message), then exit the function + if !open && acknowledgeableBrokerMessage.IsUninitialized() { + return true, nil + } + + // Set broker message to context + msgCtx = context.WithValue(msgCtx, extensions.ContextKeyIsBrokerMessage, acknowledgeableBrokerMessage.String()) + + // Execute middlewares before handling the message + if err := c.executeMiddlewares(msgCtx, &acknowledgeableBrokerMessage.BrokerMessage, func(middlewareCtx context.Context) error { + // Process message + msg, err := brokerMessageToPingMessage(acknowledgeableBrokerMessage.BrokerMessage) + if err != nil { + return err + } + + // Add correlation ID to context if it exists + if id := msg.CorrelationID(); id != "" { + middlewareCtx = context.WithValue(middlewareCtx, extensions.ContextKeyIsCorrelationID, id) + } + + // Execute the subscription function + if err := fn(middlewareCtx, msg); err != nil { + return err + } + + acknowledgeableBrokerMessage.Ack() + + return nil + }); err != nil { + c.errorHandler(msgCtx, addr, &acknowledgeableBrokerMessage, err) + // On error execute the acknowledgeableBrokerMessage nack() function and + // let the BrokerAcknowledgment decide what is the right nack behavior for the broker + acknowledgeableBrokerMessage.Nak() + } + + return false, nil +} + +// ReplyToPingOperation is a helper function to +// reply to a Ping message with a Pong message on Pong channel. +func (c *AppController) ReplyToPingOperation(ctx context.Context, recvMsg PingMessage, fn func(replyMsg *PongMessage)) error { + // Create reply message + replyMsg := NewPongMessage() + replyMsg.SetAsResponseFrom(&recvMsg) + + // Execute callback function + fn(&replyMsg) + + // Publish reply + return c.SendAsReplyToPingOperation(ctx, replyMsg) +} + +// UnsubscribeFromPingOperation will stop the reception of Ping messages from Ping channel. +// A timeout can be set in context to avoid blocking operation, if needed. +func (c *AppController) UnsubscribeFromPingOperation( + ctx context.Context, +) { + // Get channel address + addr := "v3.issue141.ping" + + // Check if there receivers for this channel + sub, exists := c.subscriptions[addr] + if !exists { + return + } + + // Set context + ctx = addAppContextValues(ctx, addr) + + // Stop the subscription + sub.Cancel(ctx) + + // Remove if from the receivers + delete(c.subscriptions, addr) + + c.logger.Info(ctx, "Unsubscribed from channel") +} + +// SendAsReplyToPingOperation will send a Pong message on Pong channel. +// +// NOTE: for now, this only support the first message from AsyncAPI list. +// If you need support for other messages, please raise an issue. +func (c *AppController) SendAsReplyToPingOperation( + ctx context.Context, + msg PongMessage, +) error { + // Set channel address + addr := "v3.issue141.pong" + + // Set correlation ID if it does not exist + if id := msg.CorrelationID(); id == "" { + c.logger.Error(ctx, extensions.ErrNoCorrelationIDSet.Error()) + return extensions.ErrNoCorrelationIDSet + + } + + // Set context + ctx = addAppContextValues(ctx, addr) + ctx = context.WithValue(ctx, extensions.ContextKeyIsDirection, "publication") + ctx = context.WithValue(ctx, extensions.ContextKeyIsCorrelationID, msg.CorrelationID()) + + // Convert to BrokerMessage + brokerMsg, err := msg.toBrokerMessage() + if err != nil { + return err + } + + // Set broker message to context + ctx = context.WithValue(ctx, extensions.ContextKeyIsBrokerMessage, brokerMsg.String()) + + // Send the message on event-broker through middlewares + return c.executeMiddlewares(ctx, &brokerMsg, func(ctx context.Context) error { + return c.broker.Publish(ctx, addr, brokerMsg) + }) +} + +// UserController is the structure that provides sending capabilities to the +// developer and and connect the broker with the User +type UserController struct { + controller +} + +// NewUserController links the User to the broker +func NewUserController(bc extensions.BrokerController, options ...ControllerOption) (*UserController, error) { + // Check if broker controller has been provided + if bc == nil { + return nil, extensions.ErrNilBrokerController + } + + // Create default controller + controller := controller{ + broker: bc, + subscriptions: make(map[string]extensions.BrokerChannelSubscription), + logger: extensions.DummyLogger{}, + middlewares: make([]extensions.Middleware, 0), + errorHandler: extensions.DefaultErrorHandler(), + } + + // Apply options + for _, option := range options { + option(&controller) + } + + return &UserController{controller: controller}, nil +} + +func (c UserController) wrapMiddlewares( + middlewares []extensions.Middleware, + callback extensions.NextMiddleware, +) func(ctx context.Context, msg *extensions.BrokerMessage) error { + var called bool + + // If there is no more middleware + if len(middlewares) == 0 { + return func(ctx context.Context, msg *extensions.BrokerMessage) error { + // Call the callback if it exists and it has not been called already + if callback != nil && !called { + called = true + return callback(ctx) + } + + // Nil can be returned, as the callback has already been called + return nil + } + } + + // Get the next function to call from next middlewares or callback + next := c.wrapMiddlewares(middlewares[1:], callback) + + // Wrap middleware into a check function that will call execute the middleware + // and call the next wrapped middleware if the returned function has not been + // called already + return func(ctx context.Context, msg *extensions.BrokerMessage) error { + // Call the middleware and the following if it has not been done already + if !called { + // Create the next call with the context and the message + nextWithArgs := func(ctx context.Context) error { + return next(ctx, msg) + } + + // Call the middleware and register it as already called + called = true + if err := middlewares[0](ctx, msg, nextWithArgs); err != nil { + return err + } + + // If next has already been called in middleware, it should not be executed again + return nextWithArgs(ctx) + } + + // Nil can be returned, as the next middleware has already been called + return nil + } +} + +func (c UserController) executeMiddlewares(ctx context.Context, msg *extensions.BrokerMessage, callback extensions.NextMiddleware) error { + // Wrap middleware to have 'next' function when calling them + wrapped := c.wrapMiddlewares(c.middlewares, callback) + + // Execute wrapped middlewares + return wrapped(ctx, msg) +} + +func addUserContextValues(ctx context.Context, addr string) context.Context { + ctx = context.WithValue(ctx, extensions.ContextKeyIsVersion, "1.0.0") + ctx = context.WithValue(ctx, extensions.ContextKeyIsProvider, "user") + return context.WithValue(ctx, extensions.ContextKeyIsChannel, addr) +} + +// Close will clean up any existing resources on the controller +func (c *UserController) Close(ctx context.Context) { + // Unsubscribing remaining channels +} + +// SendToPingOperation will send a Ping message on Ping channel. +// +// NOTE: this won't wait for reply, use the normal version to get the reply or do the catching reply manually. +// NOTE: for now, this only support the first message from AsyncAPI list. +// If you need support for other messages, please raise an issue. +func (c *UserController) SendToPingOperation( + ctx context.Context, + msg PingMessage, +) error { + // Set channel address + addr := "v3.issue141.ping" + + // Set correlation ID if it does not exist + if id := msg.CorrelationID(); id == "" { + msg.SetCorrelationID(uuid.New().String()) + } + + // Set context + ctx = addUserContextValues(ctx, addr) + ctx = context.WithValue(ctx, extensions.ContextKeyIsDirection, "publication") + ctx = context.WithValue(ctx, extensions.ContextKeyIsCorrelationID, msg.CorrelationID()) + + // Convert to BrokerMessage + brokerMsg, err := msg.toBrokerMessage() + if err != nil { + return err + } + + // Set broker message to context + ctx = context.WithValue(ctx, extensions.ContextKeyIsBrokerMessage, brokerMsg.String()) + + // Send the message on event-broker through middlewares + return c.executeMiddlewares(ctx, &brokerMsg, func(ctx context.Context) error { + return c.broker.Publish(ctx, addr, brokerMsg) + }) +} + +// RequestToPingOperation will send a Ping message on Ping channel +// and wait for a Pong message from Pong channel. +// +// If a correlation ID is set in the AsyncAPI, then this will wait for the +// reply with the same correlation ID. Otherwise, it will returns the first +// message on the reply channel. +// +// A timeout can be set in context to avoid blocking operation, if needed. +func (c *UserController) RequestToPingOperation( + ctx context.Context, + msg PingMessage, +) (PongMessage, error) { + // Get receiving channel address + addr := "v3.issue141.pong" + + // Set context + ctx = addUserContextValues(ctx, addr) + ctx = context.WithValue(ctx, extensions.ContextKeyIsDirection, "wait-for") + + // Subscribe to broker channel + sub, err := c.broker.Subscribe(ctx, addr) + if err != nil { + c.logger.Error(ctx, err.Error()) + return PongMessage{}, err + } + c.logger.Info(ctx, "Subscribed to channel") + + // Close receiver on leave + defer func() { + // Stop the subscription + sub.Cancel(ctx) + + // Logging unsubscribing + c.logger.Info(ctx, "Unsubscribed from channel") + }() + + // Set correlation ID if it does not exist + if id := msg.CorrelationID(); id == "" { + msg.SetCorrelationID(uuid.New().String()) + } + + // Send the message + if err := c.SendToPingOperation(ctx, msg); err != nil { + c.logger.Error(ctx, "error happened when sending message", extensions.LogInfo{Key: "error", Value: err.Error()}) + return PongMessage{}, fmt.Errorf("error happened when sending message: %w", err) + } + + // Wait for corresponding response + for { + // Listen to next message + msg, err := c.waitForPingOperationNextResponse(ctx, addr, sub, msg) + if err != nil { + // Return on error (e.g. context canceled or subscription closed) + // instead of looping forever + c.logger.Error(ctx, err.Error()) + return PongMessage{}, err + } + + // Continue if the message hasn't been received (e.g. correlation ID mismatch) + if msg == nil { + continue + } + + return *msg, nil + } +} + +func (c *UserController) waitForPingOperationNextResponse( + ctx context.Context, + addr string, + sub extensions.BrokerChannelSubscription, + msg PingMessage, +) (*PongMessage, error) { + // Create a context for the received response + msgCtx, cancel := context.WithCancel(context.Background()) + msgCtx = addUserContextValues(msgCtx, addr) + msgCtx = context.WithValue(msgCtx, extensions.ContextKeyIsDirection, "wait-for") + msgCtx = context.WithValue(msgCtx, extensions.ContextKeyIsCorrelationID, msg.CorrelationID()) + defer cancel() + + select { + case acknowledgeableBrokerMessage, open := <-sub.MessagesChannel(): + // If subscription is closed and there is no more message + // (i.e. uninitialized message), then the subscription ended before + // receiving the expected message + if !open && acknowledgeableBrokerMessage.IsUninitialized() { + c.logger.Error(msgCtx, "Channel closed before getting message") + return nil, extensions.ErrSubscriptionCanceled + } + + // Get new message + rmsg, err := brokerMessageToPongMessage(acknowledgeableBrokerMessage.BrokerMessage) + if err != nil { + c.logger.Error(msgCtx, err.Error()) + } + + // Acknowledge the message + acknowledgeableBrokerMessage.Ack() + + // If message doesn't have corresponding correlation ID, then ingore and continue + if msg.CorrelationID() != rmsg.CorrelationID() { + return nil, nil + } + + // Set context with received values as it is the expected message + msgCtx := context.WithValue(msgCtx, extensions.ContextKeyIsBrokerMessage, acknowledgeableBrokerMessage.String()) + + // Execute middlewares before returning + if err := c.executeMiddlewares(msgCtx, &acknowledgeableBrokerMessage.BrokerMessage, nil); err != nil { + return nil, err + } + + // Return the message to the caller + // + // NOTE: it is transformed from the broker again, as it could have + // been modified by middlewares + rmsg, err = brokerMessageToPongMessage(acknowledgeableBrokerMessage.BrokerMessage) + if err != nil { + return nil, err + } + + return &rmsg, nil + case <-ctx.Done(): // Set corresponding error if context is done + c.logger.Error(msgCtx, "Context done before getting message") + return nil, extensions.ErrContextCanceled + } +} + +// AsyncAPIVersion is the version of the used AsyncAPI document +const AsyncAPIVersion = "1.0.0" + +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. +type MessageWithCorrelationID interface { + CorrelationID() string + SetCorrelationID(id string) +} + +// Error is the error structure returned by the controller operations. +type Error struct { + Channel string + Err error +} + +// Error returns a string representation of the error. +func (e *Error) Error() string { + return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) +} + +// Message 'PingMessageFromPingChannel' reference another one at '#/components/messages/ping'. +// This should be fixed in a future version to allow message override. +// If you encounter this message, feel free to open an issue on this subject +// to let know that you need this functionnality. + +// Message 'PongMessageFromPongChannel' reference another one at '#/components/messages/pong'. +// This should be fixed in a future version to allow message override. +// If you encounter this message, feel free to open an issue on this subject +// to let know that you need this functionnality. + +// HeadersFromPingMessage is a schema from the AsyncAPI specification required in messages +type HeadersFromPingMessage struct { + CorrelationId *string `json:"correlationId,omitempty"` +} + +// PingMessagePayload is a schema from the AsyncAPI specification required in messages +type PingMessagePayload struct { + Event *string `json:"event,omitempty"` +} + +// PingMessage is the message expected for 'PingMessage' channel. +type PingMessage struct { + // Headers will be used to fill the message headers + Headers HeadersFromPingMessage + + // Payload will be inserted in the message payload + Payload PingMessagePayload +} + +// NewPingMessage creates a new PingMessage with default values if any. +func NewPingMessage() PingMessage { + var msg PingMessage + + // Set correlation ID + u := uuid.New().String() + msg.Headers.CorrelationId = &u + + return msg +} + +// brokerMessageToPingMessage will fill a new PingMessage with data from generic broker message +func brokerMessageToPingMessage(bMsg extensions.BrokerMessage) (PingMessage, error) { + var msg PingMessage + + // Unmarshal payload to expected message payload format + err := json.Unmarshal(bMsg.Payload, &msg.Payload) + if err != nil { + return msg, err + } + + // Get each headers from broker message + for k, v := range bMsg.Headers { + switch { + case k == "correlationId": // Retrieving CorrelationId header + h := string(v) + msg.Headers.CorrelationId = &h + default: + // TODO: log unknown error + } + } + + // TODO: run checks on msg type + + return msg, nil +} + +// toBrokerMessage will generate a generic broker message from PingMessage data +func (msg PingMessage) toBrokerMessage() (extensions.BrokerMessage, error) { + // TODO: implement checks on message + + // Marshal payload to JSON + payload, err := json.Marshal(msg.Payload) + if err != nil { + return extensions.BrokerMessage{}, err + } + + // Add each headers to broker message + headers := make(map[string][]byte, 1) + + // Adding CorrelationId header + if msg.Headers.CorrelationId != nil { + headers["correlationId"] = []byte(*msg.Headers.CorrelationId) + } + + return extensions.BrokerMessage{ + Headers: headers, + Payload: payload, + }, nil +} + +// CorrelationID will give the correlation ID of the message, based on AsyncAPI spec +func (msg PingMessage) CorrelationID() string { + if msg.Headers.CorrelationId != nil { + return *msg.Headers.CorrelationId + } + + return "" +} + +// SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec +func (msg *PingMessage) SetCorrelationID(id string) { + msg.Headers.CorrelationId = &id +} + +// SetAsResponseFrom will correlate the message with the one passed in parameter. +// It will assign the 'req' message correlation ID to the message correlation ID, +// both specified in AsyncAPI spec. +func (msg *PingMessage) SetAsResponseFrom(req MessageWithCorrelationID) { + id := req.CorrelationID() + msg.Headers.CorrelationId = &id +} + +// HeadersFromPongMessage is a schema from the AsyncAPI specification required in messages +type HeadersFromPongMessage struct { + CorrelationId *string `json:"correlationId,omitempty"` +} + +// PongMessagePayload is a schema from the AsyncAPI specification required in messages +type PongMessagePayload struct { + Event *string `json:"event,omitempty"` +} + +// PongMessage is the message expected for 'PongMessage' channel. +type PongMessage struct { + // Headers will be used to fill the message headers + Headers HeadersFromPongMessage + + // Payload will be inserted in the message payload + Payload PongMessagePayload +} + +// NewPongMessage creates a new PongMessage with default values if any. +func NewPongMessage() PongMessage { + var msg PongMessage + + // Set correlation ID + u := uuid.New().String() + msg.Headers.CorrelationId = &u + + return msg +} + +// brokerMessageToPongMessage will fill a new PongMessage with data from generic broker message +func brokerMessageToPongMessage(bMsg extensions.BrokerMessage) (PongMessage, error) { + var msg PongMessage + + // Unmarshal payload to expected message payload format + err := json.Unmarshal(bMsg.Payload, &msg.Payload) + if err != nil { + return msg, err + } + + // Get each headers from broker message + for k, v := range bMsg.Headers { + switch { + case k == "correlationId": // Retrieving CorrelationId header + h := string(v) + msg.Headers.CorrelationId = &h + default: + // TODO: log unknown error + } + } + + // TODO: run checks on msg type + + return msg, nil +} + +// toBrokerMessage will generate a generic broker message from PongMessage data +func (msg PongMessage) toBrokerMessage() (extensions.BrokerMessage, error) { + // TODO: implement checks on message + + // Marshal payload to JSON + payload, err := json.Marshal(msg.Payload) + if err != nil { + return extensions.BrokerMessage{}, err + } + + // Add each headers to broker message + headers := make(map[string][]byte, 1) + + // Adding CorrelationId header + if msg.Headers.CorrelationId != nil { + headers["correlationId"] = []byte(*msg.Headers.CorrelationId) + } + + return extensions.BrokerMessage{ + Headers: headers, + Payload: payload, + }, nil +} + +// CorrelationID will give the correlation ID of the message, based on AsyncAPI spec +func (msg PongMessage) CorrelationID() string { + if msg.Headers.CorrelationId != nil { + return *msg.Headers.CorrelationId + } + + return "" +} + +// SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec +func (msg *PongMessage) SetCorrelationID(id string) { + msg.Headers.CorrelationId = &id +} + +// SetAsResponseFrom will correlate the message with the one passed in parameter. +// It will assign the 'req' message correlation ID to the message correlation ID, +// both specified in AsyncAPI spec. +func (msg *PongMessage) SetAsResponseFrom(req MessageWithCorrelationID) { + id := req.CorrelationID() + msg.Headers.CorrelationId = &id +} + +const ( + // PingChannelPath is the constant representing the 'PingChannel' channel path. + PingChannelPath = "v3.issue141.ping" + // PongChannelPath is the constant representing the 'PongChannel' channel path. + PongChannelPath = "v3.issue141.pong" +) + +// ChannelsPaths is an array of all channels paths +var ChannelsPaths = []string{ + PingChannelPath, + PongChannelPath, +} diff --git a/test/v3/issues/141/asyncapi.yaml b/test/v3/issues/141/asyncapi.yaml new file mode 100644 index 00000000..3c7113e8 --- /dev/null +++ b/test/v3/issues/141/asyncapi.yaml @@ -0,0 +1,54 @@ +asyncapi: 3.0.0 +info: + title: Issue 141 - generated code comments + version: 1.0.0 + +channels: + ping: + address: v3.issue141.ping + messages: + ping: + $ref: '#/components/messages/ping' + pong: + address: v3.issue141.pong + messages: + pong: + $ref: '#/components/messages/pong' + +operations: + ping: + action: receive + channel: + $ref: '#/channels/ping' + reply: + channel: + $ref: '#/channels/pong' + +components: + messages: + ping: + headers: + type: object + properties: + correlationId: + type: string + payload: + type: object + properties: + event: + type: string + correlationId: + location: $message.header#/correlationId + pong: + headers: + type: object + properties: + correlationId: + type: string + payload: + type: object + properties: + event: + type: string + correlationId: + location: $message.header#/correlationId diff --git a/test/v3/issues/141/suite_test.go b/test/v3/issues/141/suite_test.go new file mode 100644 index 00000000..1c295556 --- /dev/null +++ b/test/v3/issues/141/suite_test.go @@ -0,0 +1,69 @@ +//go:generate go run ../../../../cmd/asyncapi-codegen -p issue141 -i ./asyncapi.yaml -o ./asyncapi.gen.go + +package issue141 + +import ( + "go/ast" + "go/parser" + "go/token" + "testing" + + "github.com/stretchr/testify/suite" +) + +func TestSuite(t *testing.T) { + suite.Run(t, NewSuite()) +} + +type Suite struct { + suite.Suite +} + +func NewSuite() *Suite { + return &Suite{} +} + +// TestExportedDeclarationsHaveDoc ensures every exported declaration in the +// generated code has a doc comment, so the generated API is fully documented +// (issue #141). +func (suite *Suite) TestExportedDeclarationsHaveDoc() { + fset := token.NewFileSet() + f, err := parser.ParseFile(fset, "asyncapi.gen.go", nil, parser.ParseComments) + suite.Require().NoError(err) + + for _, decl := range f.Decls { + suite.checkDecl(decl) + } +} + +func (suite *Suite) checkDecl(decl ast.Decl) { + switch d := decl.(type) { + case *ast.FuncDecl: + if d.Name.IsExported() { + suite.Truef(d.Doc != nil, "exported function %q has no doc comment", d.Name.Name) + } + case *ast.GenDecl: + // A doc comment on the group documents every spec in it. + if d.Doc != nil { + return + } + for _, spec := range d.Specs { + suite.checkSpec(spec) + } + } +} + +func (suite *Suite) checkSpec(spec ast.Spec) { + switch s := spec.(type) { + case *ast.TypeSpec: + if s.Name.IsExported() { + suite.Truef(s.Doc != nil, "exported type %q has no doc comment", s.Name.Name) + } + case *ast.ValueSpec: + for _, name := range s.Names { + if name.IsExported() { + suite.Truef(s.Doc != nil, "exported value %q has no doc comment", name.Name) + } + } + } +} diff --git a/test/v3/issues/145/asyncapi.gen.go b/test/v3/issues/145/asyncapi.gen.go index 4a21340e..aace7534 100644 --- a/test/v3/issues/145/asyncapi.gen.go +++ b/test/v3/issues/145/asyncapi.gen.go @@ -497,7 +497,6 @@ func (c *UserController) SendToPingRequestOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToPingRequestOperation( ctx context.Context, msg PingMessage, @@ -606,16 +605,19 @@ func (c *UserController) waitForPingRequestOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -653,6 +655,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -737,6 +740,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/test/v3/issues/148/asyncapi.gen.go b/test/v3/issues/148/asyncapi.gen.go index 5256389b..0b44f23a 100644 --- a/test/v3/issues/148/asyncapi.gen.go +++ b/test/v3/issues/148/asyncapi.gen.go @@ -496,7 +496,6 @@ func (c *UserController) SendToGetServiceInfoOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToGetServiceInfoOperation( ctx context.Context, msg RequestMessageFromReceptionChannel, @@ -605,16 +604,19 @@ func (c *UserController) waitForGetServiceInfoOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -633,6 +635,7 @@ type RequestMessageFromReceptionChannel struct { Payload string } +// NewRequestMessageFromReceptionChannel creates a new RequestMessageFromReceptionChannel with default values if any. func NewRequestMessageFromReceptionChannel() RequestMessageFromReceptionChannel { var msg RequestMessageFromReceptionChannel @@ -690,6 +693,7 @@ type ReplyMessageFromReplyChannel struct { Payload string } +// NewReplyMessageFromReplyChannel creates a new ReplyMessageFromReplyChannel with default values if any. func NewReplyMessageFromReplyChannel() ReplyMessageFromReplyChannel { var msg ReplyMessageFromReplyChannel diff --git a/test/v3/issues/150/asyncapi.gen.go b/test/v3/issues/150/asyncapi.gen.go index 6a37a5ff..2be73f21 100644 --- a/test/v3/issues/150/asyncapi.gen.go +++ b/test/v3/issues/150/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/152/asyncapi.gen.go b/test/v3/issues/152/asyncapi.gen.go index 20ec983f..965376f5 100644 --- a/test/v3/issues/152/asyncapi.gen.go +++ b/test/v3/issues/152/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/154/asyncapi.gen.go b/test/v3/issues/154/asyncapi.gen.go index 6d776099..13d32eac 100644 --- a/test/v3/issues/154/asyncapi.gen.go +++ b/test/v3/issues/154/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/156/asyncapi.gen.go b/test/v3/issues/156/asyncapi.gen.go index f35beac3..8685e06a 100644 --- a/test/v3/issues/156/asyncapi.gen.go +++ b/test/v3/issues/156/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -33,6 +36,7 @@ type TestingMessage struct { Payload TestSchema } +// NewTestingMessage creates a new TestingMessage with default values if any. func NewTestingMessage() TestingMessage { var msg TestingMessage diff --git a/test/v3/issues/162/asyncapi.gen.go b/test/v3/issues/162/asyncapi.gen.go index caf299aa..b443ae4a 100644 --- a/test/v3/issues/162/asyncapi.gen.go +++ b/test/v3/issues/162/asyncapi.gen.go @@ -491,7 +491,6 @@ func (c *UserController) PublishPing( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) AskPing( ctx context.Context, msg PingMessage, @@ -597,16 +596,19 @@ func (c *UserController) waitForPingOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -632,6 +634,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -683,6 +686,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/test/v3/issues/164/asyncapi.gen.go b/test/v3/issues/164/asyncapi.gen.go index e6929b84..f7d40408 100644 --- a/test/v3/issues/164/asyncapi.gen.go +++ b/test/v3/issues/164/asyncapi.gen.go @@ -442,16 +442,19 @@ func (c *UserController) SendToTestMapOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -467,6 +470,7 @@ type TestMapMessage struct { Payload TestMapSchema } +// NewTestMapMessage creates a new TestMapMessage with default values if any. func NewTestMapMessage() TestMapMessage { var msg TestMapMessage diff --git a/test/v3/issues/173/asyncapi.gen.go b/test/v3/issues/173/asyncapi.gen.go index 1144b106..af921b02 100644 --- a/test/v3/issues/173/asyncapi.gen.go +++ b/test/v3/issues/173/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -45,6 +48,7 @@ type Type1Message struct { Payload Type1MessagePayload } +// NewType1Message creates a new Type1Message with default values if any. func NewType1Message() Type1Message { var msg Type1Message @@ -119,6 +123,7 @@ type Type2Message struct { Payload Type2MessagePayload } +// NewType2Message creates a new Type2Message with default values if any. func NewType2Message() Type2Message { var msg Type2Message diff --git a/test/v3/issues/175/asyncapi.gen.go b/test/v3/issues/175/asyncapi.gen.go index 321484e1..7ff1e9a0 100644 --- a/test/v3/issues/175/asyncapi.gen.go +++ b/test/v3/issues/175/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -43,6 +46,7 @@ type Type1Message struct { Payload []ItemFromType1MessagePayload } +// NewType1Message creates a new Type1Message with default values if any. func NewType1Message() Type1Message { var msg Type1Message @@ -89,6 +93,7 @@ type Type2Message struct { Payload ArrayPayloadSchema } +// NewType2Message creates a new Type2Message with default values if any. func NewType2Message() Type2Message { var msg Type2Message @@ -138,6 +143,7 @@ type Type3Message struct { Payload []string } +// NewType3Message creates a new Type3Message with default values if any. func NewType3Message() Type3Message { var msg Type3Message diff --git a/test/v3/issues/181/asyncapi.gen.go b/test/v3/issues/181/asyncapi.gen.go index 5efb36d9..796737db 100644 --- a/test/v3/issues/181/asyncapi.gen.go +++ b/test/v3/issues/181/asyncapi.gen.go @@ -493,7 +493,6 @@ func (c *UserController) SendToGetServiceInfoOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToGetServiceInfoOperation( ctx context.Context, msg RequestMessage, @@ -599,16 +598,19 @@ func (c *UserController) waitForGetServiceInfoOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -619,6 +621,7 @@ type ReplyMessageFromReplyChannel struct { Payload string } +// NewReplyMessageFromReplyChannel creates a new ReplyMessageFromReplyChannel with default values if any. func NewReplyMessageFromReplyChannel() ReplyMessageFromReplyChannel { var msg ReplyMessageFromReplyChannel @@ -674,6 +677,7 @@ type RequestMessage struct { Payload string } +// NewRequestMessage creates a new RequestMessage with default values if any. func NewRequestMessage() RequestMessage { var msg RequestMessage diff --git a/test/v3/issues/185/asyncapi.gen.go b/test/v3/issues/185/asyncapi.gen.go index c9f5eaa1..83ce79b9 100644 --- a/test/v3/issues/185/asyncapi.gen.go +++ b/test/v3/issues/185/asyncapi.gen.go @@ -11,16 +11,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/186/asyncapi.gen.go b/test/v3/issues/186/asyncapi.gen.go index 76b5afb6..bb8ff740 100644 --- a/test/v3/issues/186/asyncapi.gen.go +++ b/test/v3/issues/186/asyncapi.gen.go @@ -607,16 +607,19 @@ func (c *UserController) SendToStarRequestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -637,6 +640,7 @@ type AngleMessage struct { Payload string } +// NewAngleMessage creates a new AngleMessage with default values if any. func NewAngleMessage() AngleMessage { var msg AngleMessage @@ -678,6 +682,7 @@ type StarMessage struct { Payload string } +// NewStarMessage creates a new StarMessage with default values if any. func NewStarMessage() StarMessage { var msg StarMessage diff --git a/test/v3/issues/190/asyncapi.gen.go b/test/v3/issues/190/asyncapi.gen.go index 51322b11..e936610c 100644 --- a/test/v3/issues/190/asyncapi.gen.go +++ b/test/v3/issues/190/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -44,6 +47,7 @@ type BarMessageFromFooChannel struct { Payload BarMessageFromFooChannelPayload } +// NewBarMessageFromFooChannel creates a new BarMessageFromFooChannel with default values if any. func NewBarMessageFromFooChannel() BarMessageFromFooChannel { var msg BarMessageFromFooChannel @@ -101,6 +105,7 @@ type SayHelloMessageFromHelloChannel struct { Payload SayHelloMessageFromHelloChannelPayload } +// NewSayHelloMessageFromHelloChannel creates a new SayHelloMessageFromHelloChannel with default values if any. func NewSayHelloMessageFromHelloChannel() SayHelloMessageFromHelloChannel { var msg SayHelloMessageFromHelloChannel diff --git a/test/v3/issues/192/asyncapi.gen.go b/test/v3/issues/192/asyncapi.gen.go index bb529203..b0fb1d71 100644 --- a/test/v3/issues/192/asyncapi.gen.go +++ b/test/v3/issues/192/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/209/asyncapi.gen.go b/test/v3/issues/209/asyncapi.gen.go index 4cbc7b8f..07fcdac9 100644 --- a/test/v3/issues/209/asyncapi.gen.go +++ b/test/v3/issues/209/asyncapi.gen.go @@ -10,16 +10,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } diff --git a/test/v3/issues/211/asyncapi.gen.go b/test/v3/issues/211/asyncapi.gen.go index 7283fadc..d328a4da 100644 --- a/test/v3/issues/211/asyncapi.gen.go +++ b/test/v3/issues/211/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -44,6 +47,7 @@ type EventSuccessMessage struct { Payload EventSuccessMessagePayload } +// NewEventSuccessMessage creates a new EventSuccessMessage with default values if any. func NewEventSuccessMessage() EventSuccessMessage { var msg EventSuccessMessage diff --git a/test/v3/issues/214/asyncapi.gen.go b/test/v3/issues/214/asyncapi.gen.go index b7ff15bb..d6fd215c 100644 --- a/test/v3/issues/214/asyncapi.gen.go +++ b/test/v3/issues/214/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -38,6 +41,7 @@ type TestMessageMessage struct { Payload Event } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/215/asyncapi.gen.go b/test/v3/issues/215/asyncapi.gen.go index ebd5bd77..f7929f04 100644 --- a/test/v3/issues/215/asyncapi.gen.go +++ b/test/v3/issues/215/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -43,6 +46,7 @@ type TestMessageMessage struct { Payload TestMessageMessagePayload } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/216/asyncapi.gen.go b/test/v3/issues/216/asyncapi.gen.go index 1a2406c1..581e6560 100644 --- a/test/v3/issues/216/asyncapi.gen.go +++ b/test/v3/issues/216/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "0.1.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -47,6 +50,7 @@ type EventSuccessMessage struct { Payload EventSuccessMessagePayload } +// NewEventSuccessMessage creates a new EventSuccessMessage with default values if any. func NewEventSuccessMessage() EventSuccessMessage { var msg EventSuccessMessage diff --git a/test/v3/issues/220/camel/asyncapi.gen.go b/test/v3/issues/220/camel/asyncapi.gen.go index 5a3e87c3..757b90d1 100644 --- a/test/v3/issues/220/camel/asyncapi.gen.go +++ b/test/v3/issues/220/camel/asyncapi.gen.go @@ -442,16 +442,19 @@ func (c *UserController) SendToHandlingTestingOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -462,6 +465,7 @@ type TestingEventMessageFromTestingChannel struct { Payload TestSchema } +// NewTestingEventMessageFromTestingChannel creates a new TestingEventMessageFromTestingChannel with default values if any. func NewTestingEventMessageFromTestingChannel() TestingEventMessageFromTestingChannel { var msg TestingEventMessageFromTestingChannel diff --git a/test/v3/issues/220/none/asyncapi.gen.go b/test/v3/issues/220/none/asyncapi.gen.go index bc89bccd..a1229f20 100644 --- a/test/v3/issues/220/none/asyncapi.gen.go +++ b/test/v3/issues/220/none/asyncapi.gen.go @@ -442,16 +442,19 @@ func (c *UserController) SendToHandlingTestingOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -462,6 +465,7 @@ type TestingEventMessageFromTestingChannel struct { Payload TESTSchema } +// NewTestingEventMessageFromTestingChannel creates a new TestingEventMessageFromTestingChannel with default values if any. func NewTestingEventMessageFromTestingChannel() TestingEventMessageFromTestingChannel { var msg TestingEventMessageFromTestingChannel diff --git a/test/v3/issues/222/asyncapi.gen.go b/test/v3/issues/222/asyncapi.gen.go index d8a9bbad..80948309 100644 --- a/test/v3/issues/222/asyncapi.gen.go +++ b/test/v3/issues/222/asyncapi.gen.go @@ -445,16 +445,19 @@ func (c *UserController) SendToHandleTestingOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -465,6 +468,7 @@ type TestMessageMessageFromTestingChannel struct { Payload TestSchema } +// NewTestMessageMessageFromTestingChannel creates a new TestMessageMessageFromTestingChannel with default values if any. func NewTestMessageMessageFromTestingChannel() TestMessageMessageFromTestingChannel { var msg TestMessageMessageFromTestingChannel diff --git a/test/v3/issues/224/asyncapi.gen.go b/test/v3/issues/224/asyncapi.gen.go index f235828e..486eeec8 100644 --- a/test/v3/issues/224/asyncapi.gen.go +++ b/test/v3/issues/224/asyncapi.gen.go @@ -442,16 +442,19 @@ func (c *UserController) SendToReceiveTestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -462,6 +465,7 @@ type TestMessageFromTestChannel struct { Payload ColliderDictionarySchema } +// NewTestMessageFromTestChannel creates a new TestMessageFromTestChannel with default values if any. func NewTestMessageFromTestChannel() TestMessageFromTestChannel { var msg TestMessageFromTestChannel diff --git a/test/v3/issues/224/openapidep/asyncapi.gen.go b/test/v3/issues/224/openapidep/asyncapi.gen.go index eaf52a8e..34b33b87 100644 --- a/test/v3/issues/224/openapidep/asyncapi.gen.go +++ b/test/v3/issues/224/openapidep/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -38,6 +41,7 @@ type TestMessageMessage struct { Payload PetSchema } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/233/asyncapi.gen.go b/test/v3/issues/233/asyncapi.gen.go index 7280d2de..286a38f0 100644 --- a/test/v3/issues/233/asyncapi.gen.go +++ b/test/v3/issues/233/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -38,6 +41,7 @@ type TestMessageMessage struct { Payload time.Time } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/241/asyncapi.gen.go b/test/v3/issues/241/asyncapi.gen.go index 9a5026b9..57622cb2 100644 --- a/test/v3/issues/241/asyncapi.gen.go +++ b/test/v3/issues/241/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -285,6 +288,7 @@ type PingMessageFromTestChannel struct { Payload PingMessageFromTestChannelPayload } +// NewPingMessageFromTestChannel creates a new PingMessageFromTestChannel with default values if any. func NewPingMessageFromTestChannel() PingMessageFromTestChannel { var msg PingMessageFromTestChannel diff --git a/test/v3/issues/245/asyncapi.gen.go b/test/v3/issues/245/asyncapi.gen.go index df42fa1f..e93f4012 100644 --- a/test/v3/issues/245/asyncapi.gen.go +++ b/test/v3/issues/245/asyncapi.gen.go @@ -442,16 +442,19 @@ func (c *UserController) SendToReceiveTestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -462,6 +465,7 @@ type TestMessageFromTestChannel struct { Payload TestSchema } +// NewTestMessageFromTestChannel creates a new TestMessageFromTestChannel with default values if any. func NewTestMessageFromTestChannel() TestMessageFromTestChannel { var msg TestMessageFromTestChannel diff --git a/test/v3/issues/255/default/asyncapi.gen.go b/test/v3/issues/255/default/asyncapi.gen.go index 378ceaa5..638468d1 100644 --- a/test/v3/issues/255/default/asyncapi.gen.go +++ b/test/v3/issues/255/default/asyncapi.gen.go @@ -254,16 +254,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -280,6 +283,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v3/issues/255/ignoredates/asyncapi.gen.go b/test/v3/issues/255/ignoredates/asyncapi.gen.go index 0488ac46..d0194e58 100644 --- a/test/v3/issues/255/ignoredates/asyncapi.gen.go +++ b/test/v3/issues/255/ignoredates/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -277,6 +280,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v3/issues/258/asyncapi.gen.go b/test/v3/issues/258/asyncapi.gen.go index 4bc25a0f..de1d4a79 100644 --- a/test/v3/issues/258/asyncapi.gen.go +++ b/test/v3/issues/258/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -79,6 +82,7 @@ type TestMessageMessage struct { Payload TestMessageMessagePayload } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/259/default/asyncapi.gen.go b/test/v3/issues/259/default/asyncapi.gen.go index 0ca0db97..b952aa46 100644 --- a/test/v3/issues/259/default/asyncapi.gen.go +++ b/test/v3/issues/259/default/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -279,6 +282,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v3/issues/259/forcepointers/asyncapi.gen.go b/test/v3/issues/259/forcepointers/asyncapi.gen.go index 153fe429..939a8f73 100644 --- a/test/v3/issues/259/forcepointers/asyncapi.gen.go +++ b/test/v3/issues/259/forcepointers/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -279,6 +282,7 @@ type TestMessage struct { Payload TestMessagePayload } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v3/issues/261/asyncapi.gen.go b/test/v3/issues/261/asyncapi.gen.go index b978c6d3..23a37d11 100644 --- a/test/v3/issues/261/asyncapi.gen.go +++ b/test/v3/issues/261/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -38,6 +41,7 @@ type TestMessageMessage struct { Payload FreeFormSchema } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/262/asyncapi.gen.go b/test/v3/issues/262/asyncapi.gen.go index 188c53e6..1a409f55 100644 --- a/test/v3/issues/262/asyncapi.gen.go +++ b/test/v3/issues/262/asyncapi.gen.go @@ -251,16 +251,19 @@ func (c *UserController) Close(ctx context.Context) { // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.2.3" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -281,6 +284,7 @@ type TestMessage struct { Payload string } +// NewTestMessage creates a new TestMessage with default values if any. func NewTestMessage() TestMessage { var msg TestMessage diff --git a/test/v3/issues/267/asyncapi.gen.go b/test/v3/issues/267/asyncapi.gen.go index 9671fba7..9fe90952 100644 --- a/test/v3/issues/267/asyncapi.gen.go +++ b/test/v3/issues/267/asyncapi.gen.go @@ -442,16 +442,19 @@ func (c *UserController) SendToReceiveTestOperation( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -462,6 +465,7 @@ type TestMessageFromTestChannel struct { Payload TestSchema } +// NewTestMessageFromTestChannel creates a new TestMessageFromTestChannel with default values if any. func NewTestMessageFromTestChannel() TestMessageFromTestChannel { var msg TestMessageFromTestChannel diff --git a/test/v3/issues/275/asyncapi.gen.go b/test/v3/issues/275/asyncapi.gen.go index 9652e8fc..147b0286 100644 --- a/test/v3/issues/275/asyncapi.gen.go +++ b/test/v3/issues/275/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -38,6 +41,7 @@ type TestMessageMessage struct { Payload TestSchema } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/283/asyncapi.gen.go b/test/v3/issues/283/asyncapi.gen.go index f1f7e188..99703338 100644 --- a/test/v3/issues/283/asyncapi.gen.go +++ b/test/v3/issues/283/asyncapi.gen.go @@ -15,16 +15,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -58,6 +61,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -159,6 +163,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/test/v3/issues/292/asyncapi.gen.go b/test/v3/issues/292/asyncapi.gen.go index 955eac7b..ddb79a14 100644 --- a/test/v3/issues/292/asyncapi.gen.go +++ b/test/v3/issues/292/asyncapi.gen.go @@ -491,7 +491,6 @@ func (c *UserController) SendToPingOperation( // message on the reply channel. // // A timeout can be set in context to avoid blocking operation, if needed. - func (c *UserController) RequestToPingOperation( ctx context.Context, msg PingMessage, @@ -597,16 +596,19 @@ func (c *UserController) waitForPingOperationNextResponse( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -632,6 +634,7 @@ type PingMessage struct { Payload PingMessagePayload } +// NewPingMessage creates a new PingMessage with default values if any. func NewPingMessage() PingMessage { var msg PingMessage @@ -683,6 +686,7 @@ type PongMessage struct { Payload PongMessagePayload } +// NewPongMessage creates a new PongMessage with default values if any. func NewPongMessage() PongMessage { var msg PongMessage diff --git a/test/v3/issues/294/asyncapi.gen.go b/test/v3/issues/294/asyncapi.gen.go index af9263e8..e600307b 100644 --- a/test/v3/issues/294/asyncapi.gen.go +++ b/test/v3/issues/294/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -43,6 +46,7 @@ type TestMessageMessage struct { Payload TestMessageMessagePayload } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/296/asyncapi.gen.go b/test/v3/issues/296/asyncapi.gen.go index bdf71040..9d5a9d66 100644 --- a/test/v3/issues/296/asyncapi.gen.go +++ b/test/v3/issues/296/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -46,6 +49,7 @@ type TestMessageMessage struct { Payload TestMessageMessagePayload } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/299/asyncapi.gen.go b/test/v3/issues/299/asyncapi.gen.go index dd8a9821..6d42e4f4 100644 --- a/test/v3/issues/299/asyncapi.gen.go +++ b/test/v3/issues/299/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -43,6 +46,7 @@ type TestMessageMessage struct { Payload TestMessageMessagePayload } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage diff --git a/test/v3/issues/301/asyncapi.gen.go b/test/v3/issues/301/asyncapi.gen.go index 29c367a4..f793abe5 100644 --- a/test/v3/issues/301/asyncapi.gen.go +++ b/test/v3/issues/301/asyncapi.gen.go @@ -13,16 +13,19 @@ import ( // AsyncAPIVersion is the version of the used AsyncAPI document const AsyncAPIVersion = "1.0.0" +// MessageWithCorrelationID is implemented by messages that carry a correlation ID. type MessageWithCorrelationID interface { CorrelationID() string SetCorrelationID(id string) } +// Error is the error structure returned by the controller operations. type Error struct { Channel string Err error } +// Error returns a string representation of the error. func (e *Error) Error() string { return fmt.Sprintf("channel %q: err %v", e.Channel, e.Err) } @@ -41,6 +44,7 @@ type TestMessageMessage struct { Payload []string } +// NewTestMessageMessage creates a new TestMessageMessage with default values if any. func NewTestMessageMessage() TestMessageMessage { var msg TestMessageMessage