Skip to content

Commit

Permalink
Merge pull request #14 from HDRUK/rearrange-files
Browse files Browse the repository at this point in the history
Rearrange files
  • Loading branch information
calmacx authored Oct 5, 2023
2 parents 4033ad8 + 135a03f commit e0e79e2
Show file tree
Hide file tree
Showing 21 changed files with 21 additions and 10 deletions.
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.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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)

0 comments on commit e0e79e2

Please sign in to comment.