Skip to content

[FEATURE] Bundler to have more flexible and configurable behavior for circular refsΒ #201

@412b

Description

@412b

Why do we need this improvement?

Despite being called bundler it does dereferencing, which blocks the use of it for schemas with circular references.
json-schema-ref-parser used under the hood has mutiple options for handling circular refs and even a dedicated bundle function for actually bundeling.
moreover, further down the asyncapi stack circular refs are not a problem, e.g. modelina can handle schemas with circular refs and generate code for those.

How will this change help?

it will unblock the use of bundler for cases with circular refs and make the tool more close functions-wise to its name.

Screenshots

No response

How could it be implemented/designed?

default behavior can remain the same, and additional option may enable a behavior of really just bundling
also mixed dereference via dereference.circular=ignore can be achieved.

from the first look at the code base it can be a single additional cli arg (e.g. named strategy) describing the desired behaviours:

  • dereference all (default and current behavior)
  • dereference circular
  • dereference all except circular
  • bundle (via using json-schema-ref-parser's bundle)

no real complexity of the change, but quite some additional value for the tool.

🚧 Breaking changes

No

πŸ‘€ Have you checked for similar open issues?

  • I checked and didn't find a similar issue

🏒 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions