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

enh: update models to do more validation checks #42

Merged
merged 3 commits into from
Jun 24, 2021
Merged

Conversation

satra
Copy link
Member

@satra satra commented Jun 18, 2021

This improves a bunch of validation specs for publish. However, the current implementation is completely predicated on production servers and prefixes.

Calling this a draft for now while we think about how to get info about the domain in which the schema is running. technically for most users everything should validate against the production sites. but devs may need other things.

@satra satra requested review from dchiquito and yarikoptic June 18, 2021 18:16
@codecov
Copy link

codecov bot commented Jun 18, 2021

Codecov Report

Merging #42 (d78523f) into master (8dd4a63) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #42      +/-   ##
==========================================
+ Coverage   95.72%   95.78%   +0.06%     
==========================================
  Files          11       11              
  Lines        1005     1021      +16     
==========================================
+ Hits          962      978      +16     
  Misses         43       43              
Flag Coverage Δ
unittests 95.78% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dandischema/consts.py 100.00% <100.00%> (ø)
dandischema/models.py 93.82% <100.00%> (+0.10%) ⬆️
dandischema/tests/test_datacite.py 100.00% <100.00%> (ø)
dandischema/tests/test_models.py 95.23% <100.00%> (+0.11%) ⬆️

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 8dd4a63...d78523f. Read the comment docs.

@satra
Copy link
Member Author

satra commented Jun 18, 2021

related to: dandi/dandi-archive#349

Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

primary comment is -- if pydantic already matches (and not searches) for regex -- no need to anchor any of the regexes

dandischema/models.py Outdated Show resolved Hide resolved
"[a-f0-9]{4}[-]*[a-f0-9]{4}[-]*[a-f0-9]{12}$"
)
DANDI_DOI_PATTERN = r"^10.80507/dandi\.\d{6}/\d+\.\d+\.\d+"
DANDI_PUBID_PATTERN = r"^DANDI:\d{6}/\d+\.\d+\.\d+"
Copy link
Member

Choose a reason for hiding this comment

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

same here -- .match instead of /.search and remove ^ here?

@@ -71,7 +71,7 @@ def _basic_publishmeta(dandi_id, version="v.0", prefix="10.80507"):
"schemaKey": "PublishActivity",
},
"version": version,
"doi": f"{prefix}/dandi.{dandi_id}.{version}",
"doi": f"{prefix}/dandi.{dandi_id}/{version}",
Copy link
Member

Choose a reason for hiding this comment

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

not sure if having that extra / (although allowed AFAIK) wouldn't confuse some system. Prior discussion etc dandi/dandi-archive#175 (comment)

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 think / is cleaner and still allowed, since our tests pass with datacite, but no strong opinion on my side other than it's a nice semantic break.

we just have to decide and then make sure @dchiquito uses that.

dandischema/models.py Outdated Show resolved Hide resolved
Co-authored-by: Yaroslav Halchenko <[email protected]>
@satra satra marked this pull request as ready for review June 21, 2021 14:50
@satra satra added patch Increment the patch version when merged release Create a release when this pr is merged labels Jun 22, 2021
@satra
Copy link
Member Author

satra commented Jun 22, 2021

adding release tag. @dchiquito - any comments on this PR? otherwise will merge.

@satra satra merged commit 004de55 into master Jun 24, 2021
@satra satra deleted the enh/publish-checks branch June 24, 2021 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants