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

How to finalize metadata and metadata usage for OMI #18

Closed 4lm closed 4 years ago

4lm commented 4 years ago

Hi @Bachibouzouk,

yesterday, you did send me JSON schema drafts for v1.3 and v1.4 of the OEP metadata, I included them in a gist so that other people know what we are talking about if they are reading this: link

I had a look at the getting started section on json-schema.org and realised that our draft version doesn't include descriptions (additionally to the types) and also doesn't define schema version and $id (which is obvious because we didn't decided that yet (https://github.com/OpenEnergyPlatform/organisation/issues/26). I think the possibility of adding descriptions is very handy and shouldn't be missed, because we could get rid of https://github.com/OpenEnergyPlatform/examples/wiki/Metadata-Description and could point $id directly to a single JSON schema file (that is self describing).

What do you think? Shall I add the description of v1.4 into the schema draft?

And second question, where is the description of v1.3? Maybe @Ludee or @christian-rli know that ...

4lm commented 4 years ago

Hi @Bachibouzouk,

one thing more! If try to validate the JSON metadata example (v1.4 from examples: link) I get an error:

jsonschema.exceptions.ValidationError: None is not of type 'string'

For this to not happen, null values must be allowed: https://stackoverflow.com/a/16241482

This leads to some questions:

Bachibouzouk commented 4 years ago

one thing more! If try to validate the JSON metadata example (v1.4 from examples: link) I get an error:

By using the schemas in examples/metadata/archiv/ I don't have this problem.

I would be more in favor of an empty string rather than a null/None value, is there a way to match null values to empty strings? @christian-rli - do you have a better idea of the specification here?

Bachibouzouk commented 4 years ago

And second question, where is the description of v1.3

As far as I know there is no clean one and we won't do it because we don't want people to use v1.3 anymore. We should just make sure that an existing v1.3 will not make the OEP website crash and can be rendered. @christian-rli made the description of the v1.4

Bachibouzouk commented 4 years ago

I think the possibility of adding descriptions is very handy and shouldn't be missed, because we could get rid of https://github.com/OpenEnergyPlatform/examples/wiki/Metadata-Description and could point $id directly to a single JSON schema file (that is self describing).

What do you think? Shall I add the description of v1.4 into the schema draft?

I find it a sweet idea/solution :). What do you think @MGlauer , @Ludee , @christian-rli ?

christian-rli commented 4 years ago

I think the possibility of adding descriptions is very handy and shouldn't be missed, because we could get rid of https://github.com/OpenEnergyPlatform/examples/wiki/Metadata-Description and could point $id directly to a single JSON schema file (that is self describing). What do you think? Shall I add the description of v1.4 into the schema draft?

I find it a sweet idea/solution :). What do you think @MGlauer , @Ludee , @christian-rli ?

Thank you @4lm and @Bachibouzouk for your work on the json-schema drafts! I wasn't aware of the option to add descriptions in a schema file and also think that it's a very elegant solution to provide the description. So from my end it's a "GO".

I was missing a nice online description of 1.3 and therefore created the one for 1.4. @Ludee published a description of 1.3 in a collection somewhere, but there seems to be no online access or link I could share. I'm going to send you an internal link to the file via mail.

christian-rli commented 4 years ago

I would be more in favor of an empty string rather than a null/None value, is there a way to match null values to empty strings? @christian-rli - do you have a better idea of the specification here?

I have no preference over null vs "", but If I recall correctly, @MGlauer was in favor of using null because an empty string represents a different information than null. One may interpret null directly as no value here while an empty string could mean just that - a string of zero length. In any case, changes to 1.4 are forbidden now :) So if you'd like to change that, it should go into the discussion for 1.5. We still need to decide on a place for that discussion and I hope @Ludee @MGlauer , the others and I can agree on a place for that during the next two days.

4lm commented 4 years ago

@Bachibouzouk: By using the schemas in examples/metadata/archiv/ I don't have this problem.

The JSON file in there is an empty template JSON file, which doesn't contain null values. If you take one the example files (SQL in examples/metadata/archiv/ or JSON file in examples/metadata/), it will fail because it contains null values.

@christian-rli: I have no preference over null vs "", but If I recall correctly, @MGlauer was in favor of using null because an empty string represents a different information than null. [...] In any case, changes to 1.4 are forbidden now :) So if you'd like to change that, it should go into the discussion for 1.5.

I have the same opinion as @MGlauer and empty string is not the same as a null value. Because of that we also have to possibility to define mandatory and non-mandatory fields in the schema. That's a thing we IMO should work with ...

4lm commented 4 years ago

In case we want to set mandatory and non-mandatory fields (nullable/non-nullable), I want to emphasize my question from above:

Is nulling of all values allowed? Or only specific ones? And if so which ones?

Edit: Mandatory fields should be defined via "required" list: http://json-schema.org/learn/getting-started-step-by-step.html EditEdit: So, the first decision to make would be is the specific field mandatory and second is field allowed to be a null value.

4lm commented 4 years ago

@christian-rli: also think that it's a very elegant solution to provide the description. So from my end it's a "GO".

Cool, will start to work on it! If anyone has objections, now is a good time :wink:

4lm commented 4 years ago

First draft of schema definition with description. Please head to #19 and have a look ...

4lm commented 4 years ago

I'm closing this issue. There is a metadata repo now: https://github.com/OpenEnergyPlatform/metadata