asyncapi-archived-repos/event-gateway

circular dependency

Closed this issue · 3 comments

Hi Team
In version v0.2.0 I noticed something potential bug.
When using schema referenced in its own file:

messages:
  Funddata:
    payload:
      $ref: "./schema.json"

I get an error:

time="2022-06-10T11:44:37Z" level=fatal error="error decoding AsyncAPI json doc to Document struct: error parsing AsyncAPI doc: #./schema.json: invalid reference\n#/components/messages/Funddata/payload: circular dependency

But referencing the data in same file works:

asyncapi: 2.4.0
info:
  title: datahub
  version: 2.0.1
  description: Delivering not only funddata
  contact:
    name: datahub
channels:
  edb.c2.datahub.funddata.normalized.input.v1:
    subscribe:
      message:
        $ref: '#/components/messages/Funddata'
      bindings:
        x-six-edb:
          partitions: 30
          replicas: 2
          labels:
            edb.application/edb: assigned
            edb.pipeline/edb.c2.datahub.funddata.normalized.input: assigned
            edb.channel/edb.c2.datahub.funddata.normalized.input: assigned
  components:
  x-six-edb:
    roles:
      edb.datahub.publisher:
        - read
        - write
        - delete
      edb.flex.consumer:
        - read
      edb.sixid.consumer:
        - read
  messages:
    Funddata:
      payload:
        {
          "$schema": http://json-schema.org/draft-07/schema#,
          "title": "Demo data",
          "type": "object",
          "properties": {
            "metadata": {
              "type": "object",
              "properties": {
                "messageId": {
                  "format": "uuid",
                  "type": "string"
                }
              },
              "required": [
                  "messageId"
              ]
            },
            "body": {
              "type": "object",
              "properties": {
                "edb:itemIdentifier": {
                  "type": "object",
                  "properties": {
                    "six:isin": {
                      "type": "string",
                      "pattern": ".*([a-zA-Z]{2}[0-9a-zA-Z]{10}).*"
                    }
                  },
                  "required": [
                      "six:isin"
                  ]
                }
              },
              "required": [
                  "edb:itemIdentifier"
              ]
            }
          },
          "required": [
              "metadata",
              "body"
          ]
        }
servers:
  test:
    url: [broker.mybrokers.org:9092](http://broker.mybrokers.org:9092/)
    protocol: kafka
    x-eventgateway-listener: 28002 # optional. 0.0.0.0:9092 will be used instead if missing.
    x-eventgateway-dial-mapping: '0.0.0.0:28002,[test.myeventgateway.org:8092](http://test.myeventgateway.org:8092/)' # optional.

Would be nice to be able to keep it separate...
thx

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

smoya commented

That seems more like a bug with https://github.com/asyncapi/parser-go. Would you mind @tomassatka reopen the issue there if still persists?

Thanks