Closed antonyc closed 4 months ago
Hello @antonyc ! Thanks for your interest in this project :smiley:
So if I understood correctly, if we have, for example, this AsyncAPI document:
channels:
ping:
publish:
operationId: ping
message:
$ref : '#/components/messages/Ping'
pong:
subscribe:
operationId: pong
message:
$ref: '#/components/messages/Pong'
You would like to have this kind of code generated:
const (
// PingChannelPath is the channel path for 'ping' operation
PingChannelPath = "ping"
// PongChannelPath is the channel path for 'pong' operation
PongChannelPath = "pong"
)
// ChannelsPaths is an array of all channels paths
var ChannelsPaths = []string{
PingChannelPath,
PongChannelPath,
}
That would let you check that necessary channels are generated. Would it be enough for you or did you expected something different/had something different in mind ? :)
exactly, thanks for super quick answer!
I am just trying to add it our code base, so if the PR gets merged, I probably will have some time to make a PR, but very hard to promise for me.
No problem ! Should be quick to write, I'll do that today or, more likely, tomorrow :)
Completed on tag v0.31.0 :)
Feel free to open another issue if you need anything else !
It would be nice to have to be able to perform compile-time/initialization time checks in the application when implementing brokers that expect some known channels for configuration and would error out on an unknown channel, becase currently broker accepts channel as a simple stream