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
Added Datapackage class #25
Added Datapackage class #25
Conversation
@dumyan |
b42d986
to
bc59329
Compare
@roll |
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've added a few comments but main thing is what we was discussing in Slack and what API project in #11 says - all DataPackage methods should be sync except the constructor. It's possible because we have sync methods on Profiles
class. So we need to use datapackage.Profiles.validate
here not async datapackage.validate
. We need to instantiate Profiles
class inside the async DataPackage constructor.
Usage example (from Slack):
dp = await DataPackage()
dp.descriptor
dp.add_resource()
dp.update()
// etc
For now we need to await calls of methods like update
or add_resource
.
/** | ||
* Create a Promise that will resolve with DataPackage instance. | ||
* | ||
* @param {Object} descriptor - a datapackage descriptor |
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.
object and also url string?
let mergedDescriptors | ||
|
||
return new Promise((resolve, reject) => { | ||
this._loadDescriptor(newDescriptor).then(theDescriptor => { |
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.
we don't need to support url for newDescriptor only {Object}
Please review, I have made some other changes as well: simplified code, improved docstrings and testing ps |
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.
LGTM
PS.
We will squash into one commit so it's ok.
fixes #11 (waffle.io supported form)
@roll please review