Skip to content
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

Add DatasetLinks to JSON schema #1404

Merged
merged 10 commits into from
Jan 20, 2022

Conversation

sappelhoff
Copy link
Member

addresses point one of #1393: Adding the DatasetLinks metadata field to the dataset_description.json JSON schema.

xref bids-standard/bids-specification#918

@codecov
Copy link

codecov bot commented Jan 16, 2022

Codecov Report

Merging #1404 (a7e4bae) into master (4d780ec) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1404   +/-   ##
=======================================
  Coverage   84.10%   84.10%           
=======================================
  Files          90       90           
  Lines        3631     3631           
  Branches     1098     1098           
=======================================
  Hits         3054     3054           
  Misses        483      483           
  Partials       94       94           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d780ec...a7e4bae. Read the comment docs.

@effigies
Copy link
Collaborator

The error message for the empty string is hard to interpret. Can we just make the format of the key to be alphanumeric of length >=1?

@sappelhoff
Copy link
Member Author

It may be possible using property-names

Comment on lines +60 to +61
"minLength": 1,
"pattern": "^[a-zA-Z0-9]*$"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about:

Suggested change
"minLength": 1,
"pattern": "^[a-zA-Z0-9]*$"
"pattern": "^[a-zA-Z0-9]+$"

Or would that make the error less clear?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that was my train of thought: better to be explicit here. Everyone can guess what minLength means, but few people know the difference between * and + in a regex

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't know about the error message though (on re-reading, that seems to be your concern, whereas mine was with future devs)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would change .DatasetLinks should NOT be shorter than 1 characters to '.DatasetLinks should match pattern "^[a-zA-Z0-9]+$"'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that we get both:

'.DatasetLinks should NOT be shorter than 1 characters'
".DatasetLinks property name '' is invalid"

The second one seems more helpful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that we get both

I see what you mean, but that's also the case after your suggested fix unfortunately. It'd just be

'.DatasetLinks should match pattern "^[a-zA-Z0-9]+$"'
".DatasetLinks property name '' is invalid"

instead.

I think both of these error messages are helpful though (much more helpful than before in any case, so thanks for your feedback)

Copy link
Collaborator

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it would be nice not to raise two issues for a single bad key, we shouldn't hold up this PR on that basis. One suggestion though.

bids-validator/tests/json.spec.js Show resolved Hide resolved
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
DatasetLinks: {
mylink1: 'https://www.google.com',
mylink2: 1,
mylink3: 'nope',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is now valid. Can either drop it or make it invalid.

Suggested change
mylink3: 'nope',
mylink3: ':/nope',

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll drop it and change it to a test that fails for keys like I am a key with whitespace and not alphanumeric "§%

@sappelhoff sappelhoff merged commit 4feb91b into bids-standard:master Jan 20, 2022
@sappelhoff sappelhoff deleted the datasetlinks branch January 20, 2022 14:43
rwblair pushed a commit that referenced this pull request Mar 15, 2022
* first try

* add functional DatasetLinks schema: any str bigger than len 0 --> uri

* add tests

* fix lint

* use propertyNames feature, instead of not feature

* migrated eeg_matchingpennies from GitHub to GIN

* fix formatting E501

* Update bids-validator/tests/json.spec.js

Co-authored-by: Chris Markiewicz <effigies@gmail.com>

* Update bids-validator/validators/json/schemas/dataset_description.json

* fix tests

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants