frictionlessdata / datapackage-js

A JavaScript library for working with Data Package.
http://frictionlessdata.io/
MIT License
43 stars 15 forks source link

Implement DataPackage class #11

Closed roll closed 7 years ago

roll commented 7 years ago

Overview

async DataPackage(descriptor, profile='base', raise_invalid=True, remote_profiles=False)
    valid -> bool
    errors -> list
    descriptor -> dict
    update(**values)
    add_resource(descriptor)
    resources -> Resource[]

Tasks

dumyan commented 7 years ago

@roll I'm curious about this

implement datapackage.errors getter (always empty array if raise_invalid is true otherwise list of validation errors)

Why should we hide the errors on raise_invalid? I think it would be better to show the errors if the consumer asks for them, just not raising any errors and allowing working with a invalid datapackage will be enough I think for raise_invalid.

roll commented 7 years ago

@dumyan We don't need to hide if raise_invalid = true, constructor or mutator must throw validation error. It means it's not possible to reach state with both (raise_invalid and instance with errors). It's mutual exclusive.