asyncapi / saunter

Saunter is a code-first AsyncAPI documentation generator for dotnet.
https://www.asyncapi.com/
MIT License
194 stars 55 forks source link

Multiple SubscribeOperation for same channel fails #178

Open drdamour opened 8 months ago

drdamour commented 8 months ago

In our app we publish different message types on the same channel from different functions. This all works fine if all the functions are on the same class...

[AsyncApi("Primary")]
[Channel(HubNames.CUSTOMERS)]
[SubscribeOperation()]
public class FuncCustomersUpdates
{

  [Message(typeof(CustomerUpdateEventResource), MessageId = Profiles.CUSTOMER_EVENTS_UPDATE, Title = "Customer Update")]
  [FunctionName(nameof(PublishCustomerUpdateEvents))]
  public async Task<PublishCustomerUpdateEventsResult> PublishCustomerUpdateEvents(
  ...

  [Message(typeof(CustomerAddressUpdateEventResource), MessageId = Profiles.CUSTOMER_ADDRESS_EVENTS_UPDATE, Title = "Customer Address Update")]
  [FunctionName(nameof(PublishCustomerAddressUpdateEvents))]
  public async Task<PublishCustomerAddressUpdateEventsResult> PublishCustomerAddressUpdateEvents(
  ...

}

but we do this in azure functions where it's nicer to have these as distinct function classes for different message types we publish. So very similar to #133 i would like it if we could support multiple channel/subscribe pairs across classes. eg

[AsyncApi("Primary")]
[Channel(HubNames.CUSTOMERS)]
[SubscribeOperation()]
public class FuncCustomerUpdates
{

  [Message(typeof(CustomerUpdateEventResource), MessageId = Profiles.CUSTOMER_EVENTS_UPDATE, Title = "Customer Update")]
  [FunctionName(nameof(PublishCustomerUpdateEvents))]
  public async Task<PublishCustomerUpdateEventsResult> PublishCustomerUpdateEvents(
  ...
}

[AsyncApi("Primary")]
[Channel(HubNames.CUSTOMERS)]
[SubscribeOperation()]
public class FuncCustomerAddressUpdates
{
  [Message(typeof(CustomerAddressUpdateEventResource), MessageId = Profiles.CUSTOMER_ADDRESS_EVENTS_UPDATE, Title = "Customer Address Update")]
  [FunctionName(nameof(PublishCustomerAddressUpdateEvents))]
  public async Task<PublishCustomerAddressUpdateEventsResult> PublishCustomerAddressUpdateEvents(
  ...

}

workaroudn is to make them the same partial class...which is ok but not the long term solutoin we are after