asyncapi/python-paho-template

python-paho-template doesn't work with latest RC of @asyncapi/generator

forsberg opened this issue ยท 5 comments

Describe the bug

Trying to use python-paho-template with the latest RC (v1.0.0-rc.13) fails with key.startsWith is not a function

How to Reproduce

$ cd test-ag
$ cat package.json
{
  "name": "test-ag",
  "version": "0.0.0",
  "description": "Test Asyncapi generator / Paho MQTT Template",
  "dependencies": {
    "@asyncapi/generator": "v1.0.0-rc.13",
    "npm": "^6.14.8"
  },
  "license": "ISC"
}
$ npm install
$ mkdir out
npx ag --debug https://raw.githubusercontent.com/asyncapi/python-paho-template/0f6d7ccc04139ca24cfbb76152d41f3415f60bf9/samples/temperature.yaml @asyncapi/python-paho-template -o out
Something went wrong:
TypeError: key.startsWith is not a function
    at Channel.extension (/home/forsberg/slask/test-ag/node_modules/@asyncapi/parser/lib/mixins/specification-extensions.js:56:14)
    at Channel.ext (/home/forsberg/slask/test-ag/node_modules/@asyncapi/parser/lib/mixins/specification-extensions.js:75:17)
    at getFunctionNameByChannel (/home/forsberg/slask/test-ag/node_modules/@asyncapi/generator/node_modules/@asyncapi/python-paho-template/filters/all.js:297:30)
    at Context.functionName (/home/forsberg/slask/test-ag/node_modules/@asyncapi/generator/node_modules/@asyncapi/python-paho-template/filters/all.js:19:10)
    at Template.root [as rootRenderFunc] (eval at _compile (/home/forsberg/slask/test-ag/node_modules/nunjucks/src/environment.js:631:18), <anonymous>:179:38)
    at Template.render (/home/forsberg/slask/test-ag/node_modules/nunjucks/src/environment.js:550:10)
    at Environment.renderString (/home/forsberg/slask/test-ag/node_modules/nunjucks/src/environment.js:378:17)
    at /home/forsberg/slask/test-ag/node_modules/@asyncapi/generator/lib/generator.js:639:21
    at new Promise (<anonymous>)
    at Generator.renderString (/home/forsberg/slask/test-ag/node_modules/@asyncapi/generator/lib/generator.js:638:12)

Expected behavior

I guess I'll have to suffer a bit from running the bleeding edge generator (and I will investigate if we actually need this), but the expected behaviour was that.. it would generate python code :-)

This issue has been automatically marked as stale because it has not had recent activity ๐Ÿ˜ด
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions โค๏ธ

@forsberg hey, I'm not an expert in this template, but looks like there is no issue either with the generator or template but rather the example.

example has this x-scs-function-name but expects this x-function-name. Try to just fix the extension name in the asyncapi file and see if it works as expected

I was unable to reproduce the error. The sample publishing code that gets generated doesn't provide arguments for the SensorReading constructor, but besides that it works.

not able to reproduce so closing

๐ŸŽ‰ This issue has been resolved in version 0.2.8 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€