Repository navigation
feat: created specificationUrl class - #110
Conversation
|
So our load function would look something like this const spec = await load(filePath);
await parser.parser(spec.text());
|
|
In general, my advice is that we should be reducing the cognitive load of the code, and I think creating more classes and more modules that depend on each other only makes it harder to understand. Remember what we talked about the "hops" you have to do when reading a code. If the only logic that's really different is validating a URL and fetching from a URL, then probably all you need are just "helpers" or external modules that already do that. |
|
Kudos, SonarCloud Quality Gate passed!
|
|
@fmvilas should Also |
|
Yeah, I don't think Studio needs to be able to open a URL, at least for now. As you said, you'll not be able to edit it anyway so what's the point 🤷♂️ |
| test | ||
| .stderr() | ||
| .stdout() | ||
| .command(['validate', 'https://bit.ly/asyncapi']) |
There was a problem hiding this comment.
I see that @fmvilas already reviews, so from my point of view I only suggest to log a followup issue, something good for the first contribution, to make sure tests do not rely on external resources. Basically, external resources are risky to use in tests and can cause tests to be flaky, like randomly failing just because the external resource is not available. So follow up should describe that tests should actually start independent server hosting asyncapi file, like we do in parser -> https://github.com/asyncapi/parser-js/blob/master/package.json#L20
|
From my point of view important is that help message |
| return this.filePath; | ||
| } | ||
|
|
||
| getURLPath() { |
There was a problem hiding this comment.
I think you shouldn't call this "URL path". That's a URL.
I mean, this is a URL: https://www.asynapi.com/blog.
And this is the URL path: /blog.
They're not the same and I think here you mean the full URL, not just the path part.
Why not getFileURL()?
| getURLPath() { | |
| getFileURL() { |
If you change it, you'd have to change everything else following similar notation, like const TYPE_URL_PATH = 'url-path';
|
@fmvilas as you initially requested changes you need to approve before we can merge |
|
Kudos, SonarCloud Quality Gate passed!
|
|
Looking at the changes, it's ok for me. You just have to wait for the Fran :) |
|
Sorry for the delay. Looks good to me 🚀 |
|
🎉 This PR is included in version 0.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |








Description
This PR aims to add support to fetch specification file from url.
Related issue(s)
Resolves #7