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

Fix/schemakey metaclass #13

Merged
merged 2 commits into from
May 26, 2021
Merged

Fix/schemakey metaclass #13

merged 2 commits into from
May 26, 2021

Conversation

yarikoptic
Copy link
Member

@yarikoptic yarikoptic commented May 25, 2021

Please see individual commit messages for some extra metadata.

Supplement to #6

May be we should drop that enum special handling altogether and then assignment of that const?

edit: FWIW tried to sort dct in metaclass for no effect on produced jsonschema

@codecov
Copy link

codecov bot commented May 25, 2021

Codecov Report

Merging #13 (3f557ea) into fix/schemakey (f8821a1) will decrease coverage by 0.32%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                Coverage Diff                @@
##           fix/schemakey      #13      +/-   ##
=================================================
- Coverage          94.34%   94.02%   -0.33%     
=================================================
  Files                 11       11              
  Lines                814      787      -27     
=================================================
- Hits                 768      740      -28     
- Misses                46       47       +1     
Flag Coverage Δ
unittests 94.02% <100.00%> (-0.33%) ⬇️

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

Impacted Files Coverage Δ
dandischema/models.py 91.26% <100.00%> (-0.83%) ⬇️

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 f8821a1...3f557ea. Read the comment docs.

@yarikoptic
Copy link
Member Author

yarikoptic commented May 25, 2021

argh, we need precommit here!

we have it but was not forced upon me ;-)

…hemaKey

Overloading is allowed by simply specifying the name to be used while declaring
the class in the source code.
Somehow I do not run into this behavior with pydantic 1.8.2 when using custom
metaclass.  Might be a sign of trouble but all tests pass, so I decided just
to condition on having "enum".   But then saw that resultant schema lacks "const"
so reworked to add "const" even if not enum.  May be that is not desired?
@yarikoptic yarikoptic force-pushed the fix/schemakey-metaclass branch from b807fa6 to 3f557ea Compare May 25, 2021 21:35
@satra
Copy link
Member

satra commented May 26, 2021

we are abusing schemaKey a bit. while we are making a distinction in the code between publishedasset and publisheddandiset, they are both of type dandiset and asset. i.e. the publishing metadata does not change the type.

@satra satra merged commit da1c7bf into fix/schemakey May 26, 2021
@satra satra deleted the fix/schemakey-metaclass branch May 26, 2021 01:13
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