Closed vodanh109 closed 6 years ago
I can bypass this problem with loading plain text from yaml file, rather than load from js-yaml modules Thanks
Not sure I understand the problem. Can you please post an example to reproduce the problem?
Thanks!
@fmvilas, you can try with any AsyncAPI yaml content from http://editor.asyncapi.org/ And tried with your example code:
const docs = require('asyncapi-docgen'); const asyncapi = YAML.load('./asyncapi.yaml');
try { const html = await docs.generateFullHTML(asyncapi); console.log('Done!'); console.log(html); } catch (e) { console.error(
Something went wrong: ${e.message}
); }
Then I just loaded plain text file and load into
await docs.generateFullHTML(asyncapi)
As I debug, the problem is because that the JSON parsed content from Yaml is like { [Object] } that is not a valid JSON data, and it cannot read schema version
Oh, I think I found the bug. This package doesn't have the schema for version 1.2.0. Will fix it as soon as I have time. Thanks for reporting!
Hey @vodanh109. I just released version 1.10.3 and it fixes the problem. Also, the editor has been updated. Thank you very much for spotting and reporting the error 🙌
So, apparently, this bug was actually a mix of 2 different bugs: the one I fixed above and an error in the project README examples. I just updated the examples, check it out: https://github.com/asyncapi/docgen#as-a-module-in-your-project. Thanks!
I used this module to generate HTML documents from Node, but it throws the exception:
But I can preview my YAML content on http://editor.asyncapi.org/
Please help. Thanks a lot