Skip to content

Commit

Permalink
https://github.com/lexiq-legal/pydantic_schemaorg/issues/4
Browse files Browse the repository at this point in the history
updated classes, tested
  • Loading branch information
crbaker89 committed Feb 2, 2022
1 parent 5f3bf11 commit a97271f
Show file tree
Hide file tree
Showing 1,336 changed files with 9,974 additions and 16,581 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Use [Schema.org](https://schema.org) types in [pydantic](https://pydantic-docs.h
schema.org model definitions that can be found
on [https://schema.org/version/latest/schemaorg-current-https.jsonld](https://schema.org/version/latest/schemaorg-current-https.jsonld)

## Requirements
Works with python >= 3.7 since the library uses `__future__.annotations`

## How to install

```pip install pydantic_schemaorg```<br><br>
Expand All @@ -16,14 +19,13 @@ A full (hierarchical) list of Schema.org model names can be found [here](https:/
## Example usages

```
from datetime import datetime
from pydantic_schemaorg.ScholarlyArticle import ScholarlyArticle
scholarly_article = ScholarlyArticle(url='https://github.com/lexiq-legal/pydantic_schemaorg',
sameAs='https://github.com/lexiq-legal/pydantic_schemaorg',
copyrightNotice='Free to use under the MIT license',
dateCreated=datetime.now())
print(scholarly_article.json(exclude_none=True))
dateCreated='15-12-2012')
print(scholarly_article.json())
```

```{"url": "https://github.com/lexiq-legal/pydantic_schemaorg", "sameAs": "https://github.com/lexiq-legal/pydantic_schemaorg", "@type": "ScholarlyArticle", "copyrightNotice": "Free to use under the MIT license", "dateCreated": "2021-11-30T17:31:38.454252"}```
10 changes: 2 additions & 8 deletions pydantic_schemaorg/AMRadioChannel.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING


from pydantic import Field

from pydantic_schemaorg.RadioChannel import RadioChannel


Expand All @@ -13,10 +11,6 @@ class AMRadioChannel(RadioChannel):
See: https://schema.org/AMRadioChannel
Model depth: 5
"""
type_: str = Field("AMRadioChannel", alias='@type')


type_: str = Field("AMRadioChannel", const=True, alias="@type")


if TYPE_CHECKING:

AMRadioChannel.update_forward_refs()
22 changes: 10 additions & 12 deletions pydantic_schemaorg/APIReference.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from __future__ import annotations
from typing import TYPE_CHECKING

from typing import Union, Optional, List

from pydantic import Field

from typing import Union, List, Optional, Any

from pydantic import Field
from pydantic_schemaorg.TechArticle import TechArticle


Expand All @@ -15,30 +14,29 @@ class APIReference(TechArticle):
See: https://schema.org/APIReference
Model depth: 5
"""

type_: str = Field("APIReference", const=True, alias="@type")
assemblyVersion: "Optional[Union[List[str], str]]" = Field(
type_: str = Field("APIReference", alias='@type')
assemblyVersion: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
None,
description="Associated product/technology version. e.g., .NET Framework 4.5.",
)
programmingModel: "Optional[Union[List[str], str]]" = Field(
programmingModel: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
None,
description="Indicates whether API is managed or unmanaged.",
)
assembly: "Optional[Union[List[str], str]]" = Field(
assembly: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
None,
description="Library file name e.g., mscorlib.dll, system.web.dll.",
)
executableLibraryName: "Optional[Union[List[str], str]]" = Field(
executableLibraryName: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
None,
description="Library file name e.g., mscorlib.dll, system.web.dll.",
)
targetPlatform: "Optional[Union[List[str], str]]" = Field(
targetPlatform: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
None,
description="Type of app development: phone, Metro style, desktop, XBox, etc.",
)



if TYPE_CHECKING:

APIReference.update_forward_refs()
from pydantic_schemaorg.Text import Text
10 changes: 2 additions & 8 deletions pydantic_schemaorg/Abdomen.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING


from pydantic import Field

from pydantic_schemaorg.PhysicalExam import PhysicalExam


Expand All @@ -13,10 +11,6 @@ class Abdomen(PhysicalExam):
See: https://schema.org/Abdomen
Model depth: 5
"""
type_: str = Field("Abdomen", alias='@type')


type_: str = Field("Abdomen", const=True, alias="@type")


if TYPE_CHECKING:

Abdomen.update_forward_refs()
10 changes: 2 additions & 8 deletions pydantic_schemaorg/AboutPage.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING


from pydantic import Field

from pydantic_schemaorg.WebPage import WebPage


Expand All @@ -13,10 +11,6 @@ class AboutPage(WebPage):
See: https://schema.org/AboutPage
Model depth: 4
"""
type_: str = Field("AboutPage", alias='@type')


type_: str = Field("AboutPage", const=True, alias="@type")


if TYPE_CHECKING:

AboutPage.update_forward_refs()
10 changes: 2 additions & 8 deletions pydantic_schemaorg/AcceptAction.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING


from pydantic import Field

from pydantic_schemaorg.AllocateAction import AllocateAction


Expand All @@ -14,10 +12,6 @@ class AcceptAction(AllocateAction):
See: https://schema.org/AcceptAction
Model depth: 5
"""
type_: str = Field("AcceptAction", alias='@type')


type_: str = Field("AcceptAction", const=True, alias="@type")


if TYPE_CHECKING:

AcceptAction.update_forward_refs()
100 changes: 47 additions & 53 deletions pydantic_schemaorg/Accommodation.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import annotations
from typing import TYPE_CHECKING

from decimal import Decimal
from typing import Union, Optional, List
from pydantic import StrictBool, AnyUrl

from pydantic import Field

from typing import Union, List, Optional, Any

from pydantic import Field
from pydantic_schemaorg.Place import Place


Expand All @@ -19,104 +20,97 @@ class Accommodation(Place):
See: https://schema.org/Accommodation
Model depth: 3
"""

type_: str = Field("Accommodation", const=True, alias="@type")
numberOfBedrooms: "Optional[Union[List[Union[Decimal, QuantitativeValue, str]], Union[Decimal, QuantitativeValue, str]]]" = Field(
type_: str = Field("Accommodation", alias='@type')
numberOfBedrooms: Optional[Union[List[Union[Decimal, 'Number', 'QuantitativeValue', str]], Decimal, 'Number', 'QuantitativeValue', str]] = Field(
None,
description="The total integer number of bedrooms in a some [[Accommodation]], [[ApartmentComplex]]"
"or [[FloorPlan]].",
"or [[FloorPlan]].",
)
numberOfBathroomsTotal: "Optional[Union[List[Union[int, str]], Union[int, str]]]" = Field(
numberOfBathroomsTotal: Optional[Union[List[Union[int, 'Integer', str]], int, 'Integer', str]] = Field(
None,
description="The total integer number of bathrooms in a some [[Accommodation]], following real estate"
"conventions as [documented in RESO](https://ddwiki.reso.org/display/DDW17/BathroomsTotalInteger+Field):"
'"The simple sum of the number of bathrooms. For example for a property with two Full Bathrooms'
'and one Half Bathroom, the Bathrooms Total Integer will be 3.". See also [[numberOfRooms]].',
"conventions as [documented in RESO](https://ddwiki.reso.org/display/DDW17/BathroomsTotalInteger+Field):"
"\"The simple sum of the number of bathrooms. For example for a property with two Full Bathrooms"
"and one Half Bathroom, the Bathrooms Total Integer will be 3.\". See also [[numberOfRooms]].",
)
permittedUsage: "Optional[Union[List[str], str]]" = Field(
permittedUsage: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
None,
description="Indications regarding the permitted usage of the accommodation.",
)
numberOfPartialBathrooms: "Optional[Union[List[Union[Decimal, str]], Union[Decimal, str]]]" = Field(
numberOfPartialBathrooms: Optional[Union[List[Union[Decimal, 'Number', str]], Decimal, 'Number', str]] = Field(
None,
description="Number of partial bathrooms - The total number of half and ¼ bathrooms in an [[Accommodation]]."
"This corresponds to the [BathroomsPartial field in RESO](https://ddwiki.reso.org/display/DDW17/BathroomsPartial+Field).",
"This corresponds to the [BathroomsPartial field in RESO](https://ddwiki.reso.org/display/DDW17/BathroomsPartial+Field).",
)
yearBuilt: "Optional[Union[List[Union[Decimal, str]], Union[Decimal, str]]]" = Field(
yearBuilt: Optional[Union[List[Union[Decimal, 'Number', str]], Decimal, 'Number', str]] = Field(
None,
description="The year an [[Accommodation]] was constructed. This corresponds to the [YearBuilt"
"field in RESO](https://ddwiki.reso.org/display/DDW17/YearBuilt+Field).",
"field in RESO](https://ddwiki.reso.org/display/DDW17/YearBuilt+Field).",
)
leaseLength: "Optional[Union[List[Union[QuantitativeValue, Duration, str]], Union[QuantitativeValue, Duration, str]]]" = Field(
leaseLength: Optional[Union[List[Union['Duration', 'QuantitativeValue', str]], 'Duration', 'QuantitativeValue', str]] = Field(
None,
description="Length of the lease for some [[Accommodation]], either particular to some [[Offer]]"
"or in some cases intrinsic to the property.",
"or in some cases intrinsic to the property.",
)
amenityFeature: "Optional[Union[List[Union[LocationFeatureSpecification, str]], Union[LocationFeatureSpecification, str]]]" = Field(
amenityFeature: Optional[Union[List[Union['LocationFeatureSpecification', str]], 'LocationFeatureSpecification', str]] = Field(
None,
description="An amenity feature (e.g. a characteristic or service) of the Accommodation. This generic"
"property does not make a statement about whether the feature is included in an offer for"
"the main accommodation or available at extra costs.",
"property does not make a statement about whether the feature is included in an offer for"
"the main accommodation or available at extra costs.",
)
numberOfRooms: "Optional[Union[List[Union[Decimal, QuantitativeValue, str]], Union[Decimal, QuantitativeValue, str]]]" = Field(
numberOfRooms: Optional[Union[List[Union[Decimal, 'Number', 'QuantitativeValue', str]], Decimal, 'Number', 'QuantitativeValue', str]] = Field(
None,
description="The number of rooms (excluding bathrooms and closets) of the accommodation or lodging"
"business. Typical unit code(s): ROM for room or C62 for no unit. The type of room can be"
"put in the unitText property of the QuantitativeValue.",
"business. Typical unit code(s): ROM for room or C62 for no unit. The type of room can be"
"put in the unitText property of the QuantitativeValue.",
)
tourBookingPage: "Optional[Union[List[Union[AnyUrl, str]], Union[AnyUrl, str]]]" = Field(
tourBookingPage: Optional[Union[List[Union[AnyUrl, 'URL', str]], AnyUrl, 'URL', str]] = Field(
None,
description="A page providing information on how to book a tour of some [[Place]], such as an [[Accommodation]]"
"or [[ApartmentComplex]] in a real estate setting, as well as other kinds of tours as appropriate.",
"or [[ApartmentComplex]] in a real estate setting, as well as other kinds of tours as appropriate.",
)
petsAllowed: "Optional[Union[List[Union[str, StrictBool]], Union[str, StrictBool]]]" = Field(
petsAllowed: Optional[Union[List[Union[StrictBool, 'Boolean', str, 'Text']], StrictBool, 'Boolean', str, 'Text']] = Field(
None,
description="Indicates whether pets are allowed to enter the accommodation or lodging business."
"More detailed information can be put in a text value.",
"More detailed information can be put in a text value.",
)
accommodationCategory: "Optional[Union[List[str], str]]" = Field(
accommodationCategory: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
None,
description="Category of an [[Accommodation]], following real estate conventions e.g. RESO (see"
"[PropertySubType](https://ddwiki.reso.org/display/DDW17/PropertySubType+Field),"
"and [PropertyType](https://ddwiki.reso.org/display/DDW17/PropertyType+Field)"
"fields for suggested values).",
"[PropertySubType](https://ddwiki.reso.org/display/DDW17/PropertySubType+Field),"
"and [PropertyType](https://ddwiki.reso.org/display/DDW17/PropertyType+Field)"
"fields for suggested values).",
)
floorLevel: "Optional[Union[List[str], str]]" = Field(
floorLevel: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
None,
description="The floor level for an [[Accommodation]] in a multi-storey building. Since counting"
"systems [vary internationally](https://en.wikipedia.org/wiki/Storey#Consecutive_number_floor_designations),"
"the local system should be used where possible.",
"systems [vary internationally](https://en.wikipedia.org/wiki/Storey#Consecutive_number_floor_designations),"
"the local system should be used where possible.",
)
floorSize: "Optional[Union[List[Union[QuantitativeValue, str]], Union[QuantitativeValue, str]]]" = Field(
floorSize: Optional[Union[List[Union['QuantitativeValue', str]], 'QuantitativeValue', str]] = Field(
None,
description="The size of the accommodation, e.g. in square meter or squarefoot. Typical unit code(s):"
"MTK for square meter, FTK for square foot, or YDK for square yard",
"MTK for square meter, FTK for square foot, or YDK for square yard",
)
accommodationFloorPlan: "Optional[Union[List[Union[FloorPlan, str]], Union[FloorPlan, str]]]" = Field(
accommodationFloorPlan: Optional[Union[List[Union['FloorPlan', str]], 'FloorPlan', str]] = Field(
None,
description="A floorplan of some [[Accommodation]].",
)
numberOfFullBathrooms: "Optional[Union[List[Union[Decimal, str]], Union[Decimal, str]]]" = Field(
numberOfFullBathrooms: Optional[Union[List[Union[Decimal, 'Number', str]], Decimal, 'Number', str]] = Field(
None,
description="Number of full bathrooms - The total number of full and ¾ bathrooms in an [[Accommodation]]."
"This corresponds to the [BathroomsFull field in RESO](https://ddwiki.reso.org/display/DDW17/BathroomsFull+Field).",
"This corresponds to the [BathroomsFull field in RESO](https://ddwiki.reso.org/display/DDW17/BathroomsFull+Field).",
)



if TYPE_CHECKING:

from decimal import Decimal

from pydantic_schemaorg.Number import Number
from pydantic_schemaorg.QuantitativeValue import QuantitativeValue

from pydantic_schemaorg.Integer import Integer
from pydantic_schemaorg.Text import Text
from pydantic_schemaorg.Duration import Duration

from pydantic_schemaorg.LocationFeatureSpecification import (
LocationFeatureSpecification,
)

from pydantic import AnyUrl, StrictBool

from pydantic_schemaorg.LocationFeatureSpecification import LocationFeatureSpecification
from pydantic_schemaorg.URL import URL
from pydantic_schemaorg.Boolean import Boolean
from pydantic_schemaorg.FloorPlan import FloorPlan

Accommodation.update_forward_refs()
10 changes: 2 additions & 8 deletions pydantic_schemaorg/AccountingService.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING


from pydantic import Field

from pydantic_schemaorg.FinancialService import FinancialService


Expand All @@ -14,10 +12,6 @@ class AccountingService(FinancialService):
See: https://schema.org/AccountingService
Model depth: 5
"""
type_: str = Field("AccountingService", alias='@type')


type_: str = Field("AccountingService", const=True, alias="@type")


if TYPE_CHECKING:

AccountingService.update_forward_refs()
10 changes: 2 additions & 8 deletions pydantic_schemaorg/AchieveAction.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING


from pydantic import Field

from pydantic_schemaorg.Action import Action


Expand All @@ -14,10 +12,6 @@ class AchieveAction(Action):
See: https://schema.org/AchieveAction
Model depth: 3
"""
type_: str = Field("AchieveAction", alias='@type')


type_: str = Field("AchieveAction", const=True, alias="@type")


if TYPE_CHECKING:

AchieveAction.update_forward_refs()
Loading

0 comments on commit a97271f

Please sign in to comment.