Comments (2)
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.
from cupid.
So this is not really a bug, more a feature request 😅
My current implementation was:
const cupid = require('@asyncapi/cupid');
const path = require('path');
const fs = require('fs');
async function getAsyncApiExamples() {
const docs = [];
const files = [
path.resolve(__dirname, '../asyncapi.yaml'),
]
for (const file of files) {
const asyncApiDoc = fs.readFileSync(file, 'utf8');
docs.push(asyncApiDoc);
}
try {
const mermaidFlowchart = await cupid.getRelations(docs,{syntax:'mermaid'});
console.log(mermaidFlowchart);
} catch (error) {
console.error(error);
}
}
getAsyncApiExamples();
But altering it to pre-parse the AsyncAPI documents with the custom path
option solved this problem.
const cupid = require('@asyncapi/cupid');
const path = require('path');
const fs = require('fs');
const parser = require('@asyncapi/parser');
async function getAsyncApiExamples() {
const docs = [];
const files = [
path.resolve(__dirname, '../asyncapi.yaml'),
]
for (const file of files) {
const asyncApiDoc = fs.readFileSync(file, 'utf8');
const parsedDoc = await parser.parse(asyncApiDoc, {path: file});
docs.push(parsedDoc);
}
try {
const mermaidFlowchart = await cupid.getRelations(docs,{syntax:'mermaid'});
console.log(mermaidFlowchart);
} catch (error) {
console.error(error);
}
}
getAsyncApiExamples();
This is because that we have no way to pass any options to the parser that Cupid uses.
from cupid.
Related Issues (20)
- Update README with new logo banner HOT 3
- Need for urgent changes in GitHub Actions automation HOT 2
- AsyncAPI spec v3 support in Cupid HOT 2
- Looking for new maintainers HOT 12
- Configurable animated option in reactFlow edges HOT 4
- Overlapped edges in reactFlow HOT 6
- Put some more ❤️ into the readme HOT 1
- Refactor this redundant 'await' on a non-promise HOT 4
- Remove unnecessary semicolons HOT 4
- Usage example cannot be used as is HOT 1
- Parameters are not supported for mermaid diagrams HOT 3
- Use channel server constraints HOT 1
- Support file inputs HOT 9
- Cannot provide pre-parsed AsyncAPI documents as input HOT 3
- Include Cupid as part of Async API tooling page HOT 7
- Imply metrics Map as class models HOT 10
- ReactFlow does not support multiple channels HOT 5
- [New Doc 📑]: show DiscoveredRelations type HOT 3
- Split the functions for changing default output to another output syntax by separate functions HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cupid.