-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
src/models/SpecificationFile.ts
Outdated
return this.filePath; | ||
} | ||
|
||
getURLPath() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good from my side but wait for @fmvilas as he made some good quality review
also you have some merge conflicts in package.json
@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