OpenEnergyPlatform / omi

Repository for the Open Metadata Integration (OMI). For metadata definition see metadata repo:
https://github.com/OpenEnergyPlatform/metadata
GNU Affero General Public License v3.0
7 stars 4 forks source link

Feature/add json validation against json schema #18 #19

Closed 4lm closed 4 years ago

4lm commented 4 years ago

Hi all,

This is the first draft of a metadata schema with descriptions, as discussed in #18.

Please review the schema definition of v1.4 (the second one). v1.3 will follow as soon as I have access to the descriptions.

Please note, I used TBD to mark descriptions which need to be decided on, either because they are undefined or they contain mistakes.

Edit: I also added $id and $schema.

4lm commented 4 years ago

Please note, I forgot to mark this PR as a "draft" PR. Seems like, I can't change this flag now, so please note this PR is not for merging (yet).

Bachibouzouk commented 4 years ago

Nice work @4lm ! Can you test locally that the old schema (without the description) and the new have the same schema (i.e. that you did not include a comma in a string or skipped a } or a {

We could add in the tests folder that the example .json file should match the corresponding schemas.

Don't forget to update the CHANGELOG at the end :)

4lm commented 4 years ago

@Bachibouzouk, I just added two simple tests for the two JSON schemas. Just run tox in the console. Does this answer your question?

Edit: I quoted all null values, so that they would not fail until we decide what to do with null values (null -> "null").

codecov-io commented 4 years ago

Codecov Report

Merging #19 into dev will increase coverage by 0.35%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #19      +/-   ##
==========================================
+ Coverage   80.31%   80.66%   +0.35%     
==========================================
  Files          32       34       +2     
  Lines        1285     1298      +13     
  Branches      181      181              
==========================================
+ Hits         1032     1047      +15     
+ Misses        204      203       -1     
+ Partials       49       48       -1
Impacted Files Coverage Δ
src/omi/schemas/__init__.py 100% <100%> (ø)
tests/test_schemas.py 100% <100%> (ø)
tests/test_dialects/test_oep/test_compiler.py 80% <0%> (+4.44%) :arrow_up:

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 28c620a...1e42323. Read the comment docs.

Bachibouzouk commented 4 years ago

@Bachibouzouk, I just added two simple tests for the two JSON schemas. Just run tox in the console. Does this answer your question?

Yes, I made a comment about the emplacement of the example file in "Changed files"

4lm commented 4 years ago

Will close this PR. See here why: https://github.com/OpenEnergyPlatform/organisation/issues/26#issuecomment-548330375