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

Rearrange files #14

Merged
merged 11 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions hdr_schemata/models/GWDM/create_json_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from pydantic import ValidationError
from v1_0 import Gwdm10
from v1_1 import Gwdm11
import json

Gwdm10.save_schema('1.0/schema.json')
Gwdm11.save_schema('1.1/schema.json')
Gwdm11.save_schema('latest/schema.json')


8 changes: 0 additions & 8 deletions hdr_schemata/models/GWDM/v1_0.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from datetime import date, datetime
from enum import Enum
from typing import List, Optional, Union

from pydantic import AnyUrl, BaseModel, EmailStr, Field, constr

from hdr_schemata.definitions.HDRUK import *

import json

from .Required import Required
from .Summary import Summary
from .Coverage import Coverage
Expand All @@ -14,8 +15,9 @@
from .Linkage import Linkage
from .Observations import Observation
from .DataTable import DataTable
from .Usage import Usage

class GwdmBaseModel(BaseModel):
class Gwdm10(BaseModel):
class Config:
extra = 'forbid'

Expand Down Expand Up @@ -65,3 +67,10 @@ class Config:
description='Descriptions of all tables and data elements that can be included in the dataset',
title='Structural Metadata',
)


@classmethod
def save_schema(cls,location='./1.0/schema.json'):
with open(location,'w') as f:
json.dump(cls.model_json_schema(),f,indent=6)