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

asyncapi CLI model generation fails if AnyModel is used #1561

Closed
PeteAudinate opened this issue Oct 16, 2023 · 4 comments · Fixed by #1562
Closed

asyncapi CLI model generation fails if AnyModel is used #1561

PeteAudinate opened this issue Oct 16, 2023 · 4 comments · Fixed by #1562
Labels

Comments

@PeteAudinate
Copy link
Contributor

Describe the bug

If a schema includes an "Any" type, the code in CommonModelToMetaModel.js logs an error then returns an AnyModel (

Logger.error('Failed to convert to MetaModel, defaulting to AnyModel');
).

This error logging causes the asyncapi generate model command to abort and not generate any output.

How to Reproduce

With the following:

# minimal.yml
asyncapi: 2.6.0

info:
  title: test
  version: 1.0.0

channels:
  hello:
    publish:
      message:
        payload:
          type: object
          properties:
            test: {}

Running:

asyncapi generate models rust minimal.yml -o minimal

Produces:

Error: Failed to convert to MetaModel, defaulting to AnyModel

..and no generated files.

Expected behavior

The above should generate the rust model with a serde_json::Value type.
If I manually change the Logger.error to Logger.warn in CommonModelToMetaModel.js, it works as expected.

@PeteAudinate PeteAudinate added the bug Something isn't working label Oct 16, 2023
@github-actions
Copy link
Contributor

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@jonaslagoni
Copy link
Member

Lets change it to warn then, which is probably a better representation anyway 😄

Mind helping out with it @PeteAudinate?

PeteAudinate added a commit to PeteAudinate/modelina that referenced this issue Oct 16, 2023
This is needed to prevent the asyncapi CLI from aborting when an
AnyModel is encountered.
jonaslagoni pushed a commit that referenced this issue Oct 16, 2023
This is needed to prevent the asyncapi CLI from aborting when an
AnyModel is encountered.
@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 1.9.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 2.0.0-next.25 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants