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 optional syntax to wx_shape validation #176

Merged
merged 7 commits into from
Oct 23, 2020
Merged

Conversation

CagtayFabry
Copy link
Member

@CagtayFabry CagtayFabry commented Oct 22, 2020

Changes

This allows wx_shape validation to work with optional ASDF properties.
If a property is optional the name must be put in brackets like (optional_prop) in the wx_shape section of the schema (see asdf documentation)

optional properties

Properties that are optional (not listed as required) must be indicated as such for shape validation by putting the name in brackets.
In this example, both optional_prop will only get validated if it exists in the tree.

# ASDF schema
properties:
  required_prop:
    tag: tag:stsci.edu:asdf/core/ndarray-1.0.0
  optional_prop:
    tag: tag:stsci.edu:asdf/core/ndarray-1.0.0
wx_shape:
  required_prop: [n]
  (optional_prop): [n]
required: [required_prop]

Related Issues

Closes # (add issue numbers)

Checks

  • updated CHANGELOG.md
  • updated tests
  • updated doc/
  • update example/tutorial notebooks

@CagtayFabry CagtayFabry added the validation custom ASDF validators label Oct 22, 2020
@CagtayFabry CagtayFabry self-assigned this Oct 22, 2020
@codecov
Copy link

codecov bot commented Oct 22, 2020

Codecov Report

Merging #176 into master will decrease coverage by 0.05%.
The diff coverage is 96.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #176      +/-   ##
==========================================
- Coverage   99.77%   99.72%   -0.06%     
==========================================
  Files          63       63              
  Lines        3604     3638      +34     
==========================================
+ Hits         3596     3628      +32     
- Misses          8       10       +2     
Impacted Files Coverage Δ
weldx/asdf/tags/weldx/time/datetimeindex.py 96.87% <87.50%> (-3.13%) ⬇️
weldx/asdf/validators.py 99.44% <96.87%> (-0.56%) ⬇️
...eldx/asdf/tags/weldx/debug/test_shape_validator.py 100.00% <100.00%> (ø)
weldx/asdf/tags/weldx/time/timedeltaindex.py 100.00% <100.00%> (ø)

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 ec45821...539f093. Read the comment docs.

@pep8speaks
Copy link

pep8speaks commented Oct 23, 2020

Hello @CagtayFabry! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-10-23 15:15:05 UTC

@CagtayFabry CagtayFabry marked this pull request as draft October 23, 2020 08:50
@CagtayFabry CagtayFabry marked this pull request as ready for review October 23, 2020 11:29
@CagtayFabry CagtayFabry removed the request for review from mark141 October 23, 2020 15:46
@CagtayFabry CagtayFabry merged commit 6eb9b82 into master Oct 23, 2020
@CagtayFabry CagtayFabry deleted the wx_shape_optional branch October 23, 2020 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validation custom ASDF validators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants