Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eventcatalog-plugin-generator-asyncapi] Cannot model flow between services #416

Open
1 task done
autodidaddict opened this issue Aug 16, 2023 · 3 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@autodidaddict
Copy link

autodidaddict commented Aug 16, 2023

Have you read the Contributing Guidelines on issues?

Description

I am building an event sourcing example and I am using eventcatalog to provide documentation and modeling help with it. I'm also trying to figure out how to incorporate eventcatalog in an automated code generation pipeline. I have created two async API yaml files, one for each service, and each of these files uses a $ref to look up the message definition.

The message definition comes across, as do both services. However, only one direction is ever populated. I can change variants and get the producer to populate instead of consumer and the reverse, but I cannot get a flow from one service to another to show up.

Steps to reproduce

I've taken quite a number of different steps, but here is the most recent variant.

  1. Create a rover_aggregate.yaml file
  2. Create a rover_projector.yaml file
  3. Create the events.asyncapi.yaml file

Run npm generate

I will add the corresponding YAML files in a comment

Expected behavior

I would expect that by modeling publish and subscribe across the same (or even different, I've tried both) channel in async API would show up in event catalog as 2 services, one that publishes and the other that consumes.

I am using services to model event sourcing aggregates, projectors, process managers, etc and I can't use eventcatalog as a downstream consumer of async API if it behaves like this.

Actual behavior

Depending on which variant I've tried, this is what I see.

  1. one service publishes the "position changed" event
  2. the other service does not consume it

I have tried this with the message being defined locally to each service or with the entire message being the target of the $ref

Your environment

  • EventCatalog version used: latest
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome and Arc
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS newest

NOTE I have tried both listing 2 files in a single generator pass config or using 2 different single-file generator passes. They both produce the same results.

@autodidaddict autodidaddict added the bug Something isn't working label Aug 16, 2023
@autodidaddict
Copy link
Author

Rover Projector

asyncapi: '2.6.0'
id: https://cosmonic.com/concordance/schemas/rover-projector.yaml
info:
  title: Rover Projector
  version: 1.0.0
  description: This is the rover projector
  contact:
    name: Cosmonic
    url: https://cosmonic.com
    email: info@cosmonic.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html

defaultContentType: application/json 
tags:
  - name: projector   

channels:
  rover/position:
    publish:      
      message:               
        $ref: "events.asyncapi.yaml#/components/messages/PositionChanged"

Rover Aggregate

asyncapi: '2.6.0'
id: https://cosmonic.com/concordance/schemas/rover-aggregate.yaml
info:
  title: Rover Aggregate
  version: 1.0.0
  description: This is the rover aggregate
  contact:
    name: Cosmonic
    url: https://cosmonic.com
    email: info@cosmonic.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html

defaultContentType: application/json 
tags:
  - name: aggregate    

channels:
  rover/position:
    subscribe:      
      message:              
        $ref: "events.asyncapi.yaml#/components/messages/PositionChanged"

Shared Message Schema

asyncapi: '2.6.0'
info:
  title: Common
  version: 1.0.0
  description: Common

components:
  messages:
    PositionChanged:
      summary: position
      description: position
      payload:
        $ref: '#/components/schemas/positionChangedPayload'
        
  schemas:
    positionChangedPayload:
      type: object
      properties:          
        position:
          type: number
          description: The position
        timestamp:
          type: string
          format: date-time
          description: The timestamp of the position  

@s1mrankaur
Copy link

s1mrankaur commented Jan 12, 2024

+1. It's a pretty basic expectation and the plugin-doc-generator-asyncapi is no use if it does not support flow of events between services. All of my events are being duplicated.

@lufinima
Copy link

I kind of have the similar issue, in my case if I import the asyncapi using versioning the latest version of the event doesn't get the proper association with consumer only producer.

In the base folder the index.md get generated with the proper association to producer and consumer but the versioned folder doesn't get the association with the consumer.

If I import a new version the previous one versioned gets the associations properly but the latest version only producer association is set, the base file the associations are ok.

Note

The files for testing can be any, the services both need to define de same message and schema and the issue can be replicated

See images bellow:
The base index (Ok ✅)
Base Index
The versioned 0.1.0 (Ok ✅)
Versioned 0.1.0
The versioned 0.2.0 (Not Ok ❌ )
Versioned 0.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants