Skip to content

[BUG] Custom Parsers aren't triggered on payloads that are defined though Operations.Channel #1099

Description

@liam-oldershaw-ctct

Describe the bug.

A custom parser isn't triggered on a root document like:

operations: 
  FooOperation:
    action: send
    channel:
       $ref: otherFile.yaml#/channels/BarChannel

And there is another file that defines the channel and message

channels:
  BarChannel:
    address:
    messages:
      AMessage:
        $ref: '#/components/messages/AMessage'
components:
  messages:
    AMessage:
      payload:
        schemaFormat: ....
        schema: ......

In the parsed json that is handled by packages/parser/src/custom-operations/parse-schema.ts#86 (in the variable detailed.parsed) the path to the payload with the custom schema is
$.operations.FooOperation.channel.messages.AMessage.payload

which is not covered in packages/parser/src/custom-operations/parse-schema.ts#25

A work around to this is to also re-specify the channel in the root document eg

channels:
  BarChannel:
    $ref: otherFile.yaml#/channels/BarChannel

operations: 
  FooOperation:
    action: send
    channel:
       $ref: #/channels/BarChannel

but this feels weird as the channel is already fully defined in the other file and I am looking to re-use channels for other definitions

Expected behavior

I believe customSchemasPathsV3 should also include
$.operations.*.channel.messages.*.payload

Screenshots

NA

How to Reproduce

Root AsyncApi file:

operations: 
  FooOperation:
    action: send
    channel:
       $ref: otherFile.yaml#/channels/BarChannel

Other referenced file:

channels:
  BarChannel:
    address:
    messages:
      AMessage:
        $ref: '#/components/messages/AMessage'
components:
  messages:
    AMessage:
      payload:
        schemaFormat: ....
        schema: ......

🖥️ Device Information [optional]

AsyncApi v3

👀 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 ?

Yes I am willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions