-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
error importing parse #821
Comments
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. |
Hey @sibelius, looks like the examples got overlooked when we updated the parser... I think the following should work, let me know! import { Parser } from "@asyncapi/parser";
// import component without parser onboard
import { AsyncApiComponentWP } from "@asyncapi/react-component";
// Import styles
import "@asyncapi/react-component/styles/default.min.css";
export default function AsyncApiDocsPage({ asyncapi }) {
const config = {}; // Configuration for component. This same as for normal React component
return (
<AsyncApiComponentWP schema={asyncapi} config={config} />
)
}
// This function gets called at build time
export async function getStaticProps() {
const schema = `...`; // AsyncAPI specification, fetched or pasted.
// validate and parse
const parser = new Parser();
const {document, diagnostics} = await parser.parse(schema);
// Circular references are not supported. See https://github.com/asyncapi/parser-js/issues/293
const stringified = JSON.stringify(document.json());
return {
props: {
asyncapi: stringified,
},
}
} |
it works, tks |
Description
I'm following this nextjs guide
https://github.com/asyncapi/asyncapi-react/blob/master/docs/usage/nextjs.md#usage-with-ssrssg-static-documentation
and I can't import
parse
Expected result
should work
Actual result
and I can't import
parse
Steps to reproduce
try to use this on docusaurus
it breaks on 1.0.3
Troubleshooting
The text was updated successfully, but these errors were encountered: