generator: parser 1.0.2 incompatible with current generator

Describe the bug

Using parser 1.0.2 with generator 1.0.0-rc.13 results in errors:

Error: Parameter "asyncapiDocument" must be an AsyncAPIDocument object.
    at Generator.generate (/Users/david/projects/antora/extensions/asyncapi/antora-asyncapi/node_modules/@asyncapi/generator/lib/generator.js:154:64)
    at generate (/Users/david/projects/antora/extensions/asyncapi/antora-asyncapi/lib/antora-asyncapi.js:107:40)
    at process._tickCallback (internal/process/next_tick.js:68:7)

How to Reproduce

package.json:

    "@asyncapi/generator": "1.0.0-rc.13",
    "@asyncapi/parser": "1.0.2",

code:

      const parsed = await parser.parse(sourceString)
      const asciidoc = await generator.generate(parsed)

To see this in action, clone https://gitlab.com/djencks/antora-asyncapi, change the version of the parser to 1.0.2, run npm i, clone https://gitlab.com/djencks/antora-extension-examples, in antora-asyncapi change the location of @djencks/antora-asyncapi to the file system location, and run npm run clean-build.

Expected behavior

I expected my code to continue to work as you guys released upgrades.

I suggest that you have the generator export the parser it uses so I don’t have to try to keep versions in sync:

module.exports = Generator;
module.exports.parse = parse;

Then I can get the correct version of the parser easily without having to try to keep up with whatever you are doing.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

It turns out for my use case it doesn’t make any sense to use the Generator, it is much much simpler to use the parser directly and manage templates myself. Therefore, I don’t expect to work on this any more.

I can vouch in here to say that @djencks project is working fine for me as well in the configuration he describes. (I was the one who reported the initial error to him)