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] Doesn't work for Hello world example from AsyncAPI #1488

Open
2 tasks done
slavaGanzin opened this issue Jul 29, 2024 · 7 comments
Open
2 tasks done

[BUG] Doesn't work for Hello world example from AsyncAPI #1488

slavaGanzin opened this issue Jul 29, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@slavaGanzin
Copy link

Describe the bug.

Hello, there awesome work on asyncapi spec!

So I copy and paste this example:
https://www.asyncapi.com/docs/tutorials/getting-started/hello-world

asyncapi: 3.0.0
info:
  title: Hello world application
  version: '0.1.0'
channels:
  hello:
    address: 'hello'
    messages:
      sayHelloMessage:
        payload:
          type: string
          pattern: '^hello .+$'
operations:
  receiveHello:
    action: 'receive'
    channel:
      $ref: '#/channels/hello'

And run:

$ asyncapi  generate models python asyncapi.yaml -o python

(node:29818) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
│
 ›   Warning: Python generator, cannot generate this type of model, AnonymousSchema1
◇  Successfully generated the following models: 

So it seems, like Modelina couldn't parse this file, and it could read names (thus, generating AnonymousSchema1)

Expected behavior

Well, generate the code

Screenshots

.

How to Reproduce

.

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

None

@slavaGanzin slavaGanzin added the bug Something isn't working label Jul 29, 2024
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.

@slavaGanzin
Copy link
Author

slavaGanzin commented Jul 30, 2024

Strangely you need to pass title to payload:

asyncapi: 3.0.0
info:
  title: Hello world application
  version: '0.1.0'
channels:
  hello:
    address: 'hello'
    messages:
      sayHelloMessage:  # it doesn't read message name from here
        payload:
          title: SayHelloMessage # so you need to put it here
          type: string
          pattern: '^hello .+$'
operations:
  receiveHello:
    action: 'receive'
    channel:
      $ref: '#/channels/hello'

But now I get:

Could not dereference $ref in input, is all the references correct? 1 error occurred while reading

@Amzani
Copy link
Collaborator

Amzani commented Jul 30, 2024

Hi @slavaGanzin

The generate model is now part of modelina
cc @jonaslagoni could you transfer this issue?
Thanks

@jonaslagoni
Copy link
Member

I cant transfer it as I am not maintainer of Cli 🙂

@jonaslagoni
Copy link
Member

jonaslagoni commented Jul 30, 2024

in short @slavaGanzin, it's because Modelina only generate payload representations, not messages. I.e. it is not generating anything for python, unless string can be rendered someway.

    messages:
      sayHelloMessage:  # it doesn't read message name from here
        payload:
          title: SayHelloMessage # so you need to put it here
          type: string
          pattern: '^hello .+$'

@slavaGanzin
Copy link
Author

@Amzani @jonaslagoni I know that it is a Modellina responsibility. But I shouldn't - I was advertised that the generator would generate a model, but it didn't. And the problem is actually that the AsyncAPI generator does not deliver what is promised on the AsyncAPI website.

@Wck-iipi
Copy link

I would like to work on this issue. However, since this is modelina issue, should I create a new issue and then work on it or do something else?

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

4 participants