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

[BUG] Inaccurate error in asyncapi optimize #1626

Open
2 tasks done
derberg opened this issue Jan 14, 2025 · 0 comments
Open
2 tasks done

[BUG] Inaccurate error in asyncapi optimize #1626

derberg opened this issue Jan 14, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@derberg
Copy link
Member

derberg commented Jan 14, 2025

Describe the bug.

I have AsyncAPI document with broken message reference in line 39:

asyncapi: 3.0.0

info:
  title: Account Service
  version: 1.0.0
  description: This service is in charge of processing user signups

servers: 
  development:
    host: loca{dupa}lhost:5672
    description: Development AMQP broker.
    protocol: amqp
    protocolVersion: 0-9-1

  staging:
    host: rabbitmq-staging.in.mycompany.com:5672
    description: RabbitMQ broker for the staging environment.
    protocol: amqp
    protocolVersion: 0-9-1

  production:
    host: rabbitmq.in.mycompany.com:5672
    description: RabbitMQ broker for the production environment.
    protocol: amqp
    protocolVersion: 0-9-1

channels:
  userSignedup:
    address: user/signedup
    messages:
      UserSignedUp:
        $ref: '#/components/messages/UserSignedUp'
operations:
  sendUserSignedup:
    action: send
    channel:
      $ref: '#/channels/userSignedup'
    messages:
      - $ref: '#/components/messages/UserSignedUp'
components:
  messages:
    UserSignedUp:
      payload:
        type: object
        properties:
          displayName:
            type: string
            description: Name of the user
          email:
            type: string
            format: email
            description: Email of the user

When I run: asyncapi optimize ./asyncapi-client.yaml I get error like

[
  {
    code: 'asyncapi3-operation-messages-from-referred-channel',
    message: 'Operation message does not belong to the specified channel.',
    path: [ 'operations', 'sendUserSignedup', 'messages', '0' ],
    severity: 0,
    range: { start: [Object], end: [Object] }
  }
]
ValidationError: There is no file or context with name "./asyncapi-client.yaml".

The array with validation error info is correct. I mean, maybe object should be rendered instead of [Object] but in general it is ok.

The problem is with the last line:
ValidationError: There is no file or context with name "./asyncapi-client.yaml".

This error just doesn't make sense, the path reference was correct, otherwise validation would not catch the error with the message

Expected behavior

Remove the misleading error message

Screenshots

no

How to Reproduce

already described in description

🥦 Browser

None

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

No, someone else can work on it

@derberg derberg added the bug Something isn't working label Jan 14, 2025
@github-project-automation github-project-automation bot moved this to To Triage in CLI - Kanban Jan 14, 2025
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
Status: To Triage
Development

No branches or pull requests

1 participant