Skip to content

Commit

Permalink
set constant=True for pydantic types (resolves ambiguity in model val…
Browse files Browse the repository at this point in the history
…idation)

change datatype for Number to Union of int and float
  • Loading branch information
crbaker89 committed Feb 18, 2022
1 parent 0708fc7 commit 4ff4a3a
Show file tree
Hide file tree
Showing 1,333 changed files with 1,808 additions and 1,809 deletions.
2 changes: 1 addition & 1 deletion pydantic_schemaorg/AMRadioChannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class AMRadioChannel(RadioChannel):
See: https://schema.org/AMRadioChannel
Model depth: 5
"""
type_: str = Field(default="AMRadioChannel", alias='@type')
type_: str = Field(default="AMRadioChannel", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/APIReference.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class APIReference(TechArticle):
See: https://schema.org/APIReference
Model depth: 5
"""
type_: str = Field(default="APIReference", alias='@type')
type_: str = Field(default="APIReference", alias='@type', constant=True)
assemblyVersion: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
default=None,
description="Associated product/technology version. e.g., .NET Framework 4.5.",
Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemaorg/Abdomen.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class Abdomen(PhysicalExam):
See: https://schema.org/Abdomen
Model depth: 5
"""
type_: str = Field(default="Abdomen", alias='@type')
type_: str = Field(default="Abdomen", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AboutPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class AboutPage(WebPage):
See: https://schema.org/AboutPage
Model depth: 4
"""
type_: str = Field(default="AboutPage", alias='@type')
type_: str = Field(default="AboutPage", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AcceptAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class AcceptAction(AllocateAction):
See: https://schema.org/AcceptAction
Model depth: 5
"""
type_: str = Field(default="AcceptAction", alias='@type')
type_: str = Field(default="AcceptAction", alias='@type', constant=True)

16 changes: 8 additions & 8 deletions pydantic_schemaorg/Accommodation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Accommodation(Place):
See: https://schema.org/Accommodation
Model depth: 3
"""
type_: str = Field(default="Accommodation", alias='@type')
numberOfBedrooms: Optional[Union[List[Union[Decimal, 'Number', 'QuantitativeValue', str]], Decimal, 'Number', 'QuantitativeValue', str]] = Field(
type_: str = Field(default="Accommodation", alias='@type', constant=True)
numberOfBedrooms: Optional[Union[List[Union[int, float, 'Number', 'QuantitativeValue', str]], int, float, 'Number', 'QuantitativeValue', str]] = Field(
default=None,
description="The total integer number of bedrooms in a some [[Accommodation]], [[ApartmentComplex]]"
"or [[FloorPlan]].",
Expand All @@ -37,17 +37,17 @@ class Accommodation(Place):
default=None,
description="Indications regarding the permitted usage of the accommodation.",
)
numberOfPartialBathrooms: Optional[Union[List[Union[Decimal, 'Number', str]], Decimal, 'Number', str]] = Field(
numberOfPartialBathrooms: Optional[Union[List[Union[int, float, 'Number', str]], int, float, 'Number', str]] = Field(
default=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).",
)
yearBuilt: Optional[Union[List[Union[Decimal, 'Number', str]], Decimal, 'Number', str]] = Field(
yearBuilt: Optional[Union[List[Union[int, float, 'Number', str]], int, float, 'Number', str]] = Field(
default=None,
description="The year an [[Accommodation]] was constructed. This corresponds to the [YearBuilt"
"field in RESO](https://ddwiki.reso.org/display/DDW17/YearBuilt+Field).",
)
leaseLength: Optional[Union[List[Union['QuantitativeValue', 'Duration', str]], 'QuantitativeValue', 'Duration', str]] = Field(
leaseLength: Optional[Union[List[Union['Duration', 'QuantitativeValue', str]], 'Duration', 'QuantitativeValue', str]] = Field(
default=None,
description="Length of the lease for some [[Accommodation]], either particular to some [[Offer]]"
"or in some cases intrinsic to the property.",
Expand All @@ -58,7 +58,7 @@ class Accommodation(Place):
"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, 'Number', 'QuantitativeValue', str]], Decimal, 'Number', 'QuantitativeValue', str]] = Field(
numberOfRooms: Optional[Union[List[Union[int, float, 'Number', 'QuantitativeValue', str]], int, float, 'Number', 'QuantitativeValue', str]] = Field(
default=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"
Expand All @@ -69,7 +69,7 @@ class Accommodation(Place):
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.",
)
petsAllowed: Optional[Union[List[Union[StrictBool, 'Boolean', str, 'Text']], StrictBool, 'Boolean', str, 'Text']] = Field(
petsAllowed: Optional[Union[List[Union[str, 'Text', StrictBool, 'Boolean']], str, 'Text', StrictBool, 'Boolean']] = Field(
default=None,
description="Indicates whether pets are allowed to enter the accommodation or lodging business."
"More detailed information can be put in a text value.",
Expand All @@ -96,7 +96,7 @@ class Accommodation(Place):
default=None,
description="A floorplan of some [[Accommodation]].",
)
numberOfFullBathrooms: Optional[Union[List[Union[Decimal, 'Number', str]], Decimal, 'Number', str]] = Field(
numberOfFullBathrooms: Optional[Union[List[Union[int, float, 'Number', str]], int, float, 'Number', str]] = Field(
default=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).",
Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemaorg/AccountingService.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class AccountingService(FinancialService):
See: https://schema.org/AccountingService
Model depth: 5
"""
type_: str = Field(default="AccountingService", alias='@type')
type_: str = Field(default="AccountingService", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AchieveAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class AchieveAction(Action):
See: https://schema.org/AchieveAction
Model depth: 3
"""
type_: str = Field(default="AchieveAction", alias='@type')
type_: str = Field(default="AchieveAction", alias='@type', constant=True)

8 changes: 4 additions & 4 deletions pydantic_schemaorg/Action.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Action(Thing):
See: https://schema.org/Action
Model depth: 2
"""
type_: str = Field(default="Action", alias='@type')
type_: str = Field(default="Action", alias='@type', constant=True)
result: Optional[Union[List[Union['Thing', str]], 'Thing', str]] = Field(
default=None,
description="The result produced in the action. e.g. John wrote *a book*.",
Expand All @@ -31,7 +31,7 @@ class Action(Thing):
"Also known as the semantic roles patient, affected or undergoer (which change their"
"state) or theme (which doesn't). e.g. John read *a book*.",
)
participant: Optional[Union[List[Union['Person', 'Organization', str]], 'Person', 'Organization', str]] = Field(
participant: Optional[Union[List[Union['Organization', 'Person', str]], 'Organization', 'Person', str]] = Field(
default=None,
description="Other co-agents that participated in the action indirectly. e.g. John wrote a book with"
"*Steve*.",
Expand All @@ -54,7 +54,7 @@ class Action(Thing):
"Event uses startDate/endDate instead of startTime/endTime, even when describing"
"dates with times. This situation may be clarified in future revisions.",
)
agent: Optional[Union[List[Union['Person', 'Organization', str]], 'Person', 'Organization', str]] = Field(
agent: Optional[Union[List[Union['Organization', 'Person', str]], 'Organization', 'Person', str]] = Field(
default=None,
description="The direct performer or driver of the action (animate or inanimate). e.g. *John* wrote"
"a book.",
Expand Down Expand Up @@ -84,8 +84,8 @@ class Action(Thing):

if TYPE_CHECKING:
from pydantic_schemaorg.Thing import Thing
from pydantic_schemaorg.Person import Person
from pydantic_schemaorg.Organization import Organization
from pydantic_schemaorg.Person import Person
from pydantic_schemaorg.Text import Text
from pydantic_schemaorg.VirtualLocation import VirtualLocation
from pydantic_schemaorg.PostalAddress import PostalAddress
Expand Down
14 changes: 7 additions & 7 deletions pydantic_schemaorg/ActionAccessSpecification.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ class ActionAccessSpecification(Intangible):
See: https://schema.org/ActionAccessSpecification
Model depth: 3
"""
type_: str = Field(default="ActionAccessSpecification", alias='@type')
type_: str = Field(default="ActionAccessSpecification", alias='@type', constant=True)
category: Optional[Union[List[Union[AnyUrl, 'URL', str, 'Text', 'PhysicalActivityCategory', 'Thing']], AnyUrl, 'URL', str, 'Text', 'PhysicalActivityCategory', 'Thing']] = Field(
default=None,
description="A category for the item. Greater signs or slashes can be used to informally indicate a"
"category hierarchy.",
)
availabilityStarts: Optional[Union[List[Union[ISO8601Date, 'DateTime', time, 'Time', ISO8601Date, 'Date', str]], ISO8601Date, 'DateTime', time, 'Time', ISO8601Date, 'Date', str]] = Field(
availabilityStarts: Optional[Union[List[Union[ISO8601Date, 'DateTime', ISO8601Date, 'Date', time, 'Time', str]], ISO8601Date, 'DateTime', ISO8601Date, 'Date', time, 'Time', str]] = Field(
default=None,
description="The beginning of the availability of the product or service included in the offer.",
)
eligibleRegion: Optional[Union[List[Union[str, 'Text', 'GeoShape', 'Place']], str, 'Text', 'GeoShape', 'Place']] = Field(
eligibleRegion: Optional[Union[List[Union[str, 'Text', 'Place', 'GeoShape']], str, 'Text', 'Place', 'GeoShape']] = Field(
default=None,
description="The ISO 3166-1 (ISO 3166-1 alpha-2) or ISO 3166-2 code, the place, or the GeoShape for"
"the geo-political region(s) for which the offer or delivery charge specification is"
Expand All @@ -43,11 +43,11 @@ class ActionAccessSpecification(Intangible):
description="An Offer which must be accepted before the user can perform the Action. For example, the"
"user may need to buy a movie before being able to watch it.",
)
availabilityEnds: Optional[Union[List[Union[ISO8601Date, 'DateTime', time, 'Time', ISO8601Date, 'Date', str]], ISO8601Date, 'DateTime', time, 'Time', ISO8601Date, 'Date', str]] = Field(
availabilityEnds: Optional[Union[List[Union[ISO8601Date, 'DateTime', ISO8601Date, 'Date', time, 'Time', str]], ISO8601Date, 'DateTime', ISO8601Date, 'Date', time, 'Time', str]] = Field(
default=None,
description="The end of the availability of the product or service included in the offer.",
)
ineligibleRegion: Optional[Union[List[Union[str, 'Text', 'GeoShape', 'Place']], str, 'Text', 'GeoShape', 'Place']] = Field(
ineligibleRegion: Optional[Union[List[Union[str, 'Text', 'Place', 'GeoShape']], str, 'Text', 'Place', 'GeoShape']] = Field(
default=None,
description="The ISO 3166-1 (ISO 3166-1 alpha-2) or ISO 3166-2 code, the place, or the GeoShape for"
"the geo-political region(s) for which the offer or delivery charge specification is"
Expand All @@ -61,10 +61,10 @@ class ActionAccessSpecification(Intangible):
from pydantic_schemaorg.PhysicalActivityCategory import PhysicalActivityCategory
from pydantic_schemaorg.Thing import Thing
from pydantic_schemaorg.DateTime import DateTime
from pydantic_schemaorg.Time import Time
from pydantic_schemaorg.Date import Date
from pydantic_schemaorg.GeoShape import GeoShape
from pydantic_schemaorg.Time import Time
from pydantic_schemaorg.Place import Place
from pydantic_schemaorg.GeoShape import GeoShape
from pydantic_schemaorg.Boolean import Boolean
from pydantic_schemaorg.MediaSubscription import MediaSubscription
from pydantic_schemaorg.Offer import Offer
2 changes: 1 addition & 1 deletion pydantic_schemaorg/ActionStatusType.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class ActionStatusType(StatusEnumeration):
See: https://schema.org/ActionStatusType
Model depth: 5
"""
type_: str = Field(default="ActionStatusType", alias='@type')
type_: str = Field(default="ActionStatusType", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/ActivateAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class ActivateAction(ControlAction):
See: https://schema.org/ActivateAction
Model depth: 4
"""
type_: str = Field(default="ActivateAction", alias='@type')
type_: str = Field(default="ActivateAction", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/ActivationFee.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class ActivationFee(PriceComponentTypeEnumeration):
See: https://schema.org/ActivationFee
Model depth: 5
"""
type_: str = Field(default="ActivationFee", alias='@type')
type_: str = Field(default="ActivationFee", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/ActiveActionStatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class ActiveActionStatus(ActionStatusType):
See: https://schema.org/ActiveActionStatus
Model depth: 6
"""
type_: str = Field(default="ActiveActionStatus", alias='@type')
type_: str = Field(default="ActiveActionStatus", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/ActiveNotRecruiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class ActiveNotRecruiting(MedicalStudyStatus):
See: https://schema.org/ActiveNotRecruiting
Model depth: 6
"""
type_: str = Field(default="ActiveNotRecruiting", alias='@type')
type_: str = Field(default="ActiveNotRecruiting", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AddAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class AddAction(UpdateAction):
See: https://schema.org/AddAction
Model depth: 4
"""
type_: str = Field(default="AddAction", alias='@type')
type_: str = Field(default="AddAction", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AdministrativeArea.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class AdministrativeArea(Place):
See: https://schema.org/AdministrativeArea
Model depth: 3
"""
type_: str = Field(default="AdministrativeArea", alias='@type')
type_: str = Field(default="AdministrativeArea", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AdultEntertainment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class AdultEntertainment(EntertainmentBusiness):
See: https://schema.org/AdultEntertainment
Model depth: 5
"""
type_: str = Field(default="AdultEntertainment", alias='@type')
type_: str = Field(default="AdultEntertainment", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AdvertiserContentArticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ class AdvertiserContentArticle(Article):
See: https://schema.org/AdvertiserContentArticle
Model depth: 4
"""
type_: str = Field(default="AdvertiserContentArticle", alias='@type')
type_: str = Field(default="AdvertiserContentArticle", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AerobicActivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ class AerobicActivity(PhysicalActivityCategory):
See: https://schema.org/AerobicActivity
Model depth: 5
"""
type_: str = Field(default="AerobicActivity", alias='@type')
type_: str = Field(default="AerobicActivity", alias='@type', constant=True)

10 changes: 5 additions & 5 deletions pydantic_schemaorg/AggregateOffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class AggregateOffer(Offer):
See: https://schema.org/AggregateOffer
Model depth: 4
"""
type_: str = Field(default="AggregateOffer", alias='@type')
offers: Optional[Union[List[Union['Offer', 'Demand', str]], 'Offer', 'Demand', str]] = Field(
type_: str = Field(default="AggregateOffer", alias='@type', constant=True)
offers: Optional[Union[List[Union['Demand', 'Offer', str]], 'Demand', 'Offer', str]] = Field(
default=None,
description="An offer to provide this item—for example, an offer to sell a product, rent the"
"DVD of a movie, perform a service, or give away tickets to an event. Use [[businessFunction]]"
Expand All @@ -29,14 +29,14 @@ class AggregateOffer(Offer):
"of common types, it can be used in others. In that case, using a second type, such as Product"
"or a subtype of Product, can clarify the nature of the offer.",
)
lowPrice: Optional[Union[List[Union[Decimal, 'Number', str, 'Text']], Decimal, 'Number', str, 'Text']] = Field(
lowPrice: Optional[Union[List[Union[int, float, 'Number', str, 'Text']], int, float, 'Number', str, 'Text']] = Field(
default=None,
description="The lowest price of all offers available. Usage guidelines: * Use values from 0123456789"
"(Unicode 'DIGIT ZERO' (U+0030) to 'DIGIT NINE' (U+0039)) rather than superficially"
"similiar Unicode symbols. * Use '.' (Unicode 'FULL STOP' (U+002E)) rather than ',' to"
"indicate a decimal point. Avoid using these symbols as a readability separator.",
)
highPrice: Optional[Union[List[Union[Decimal, 'Number', str, 'Text']], Decimal, 'Number', str, 'Text']] = Field(
highPrice: Optional[Union[List[Union[int, float, 'Number', str, 'Text']], int, float, 'Number', str, 'Text']] = Field(
default=None,
description="The highest price of all offers available. Usage guidelines: * Use values from 0123456789"
"(Unicode 'DIGIT ZERO' (U+0030) to 'DIGIT NINE' (U+0039)) rather than superficially"
Expand All @@ -50,8 +50,8 @@ class AggregateOffer(Offer):


if TYPE_CHECKING:
from pydantic_schemaorg.Offer import Offer
from pydantic_schemaorg.Demand import Demand
from pydantic_schemaorg.Offer import Offer
from pydantic_schemaorg.Number import Number
from pydantic_schemaorg.Text import Text
from pydantic_schemaorg.Integer import Integer
2 changes: 1 addition & 1 deletion pydantic_schemaorg/AggregateRating.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AggregateRating(Rating):
See: https://schema.org/AggregateRating
Model depth: 4
"""
type_: str = Field(default="AggregateRating", alias='@type')
type_: str = Field(default="AggregateRating", alias='@type', constant=True)
reviewCount: Optional[Union[List[Union[int, 'Integer', str]], int, 'Integer', str]] = Field(
default=None,
description="The count of total number of reviews.",
Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemaorg/AgreeAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class AgreeAction(ReactAction):
See: https://schema.org/AgreeAction
Model depth: 5
"""
type_: str = Field(default="AgreeAction", alias='@type')
type_: str = Field(default="AgreeAction", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/Airline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Airline(Organization):
See: https://schema.org/Airline
Model depth: 3
"""
type_: str = Field(default="Airline", alias='@type')
type_: str = Field(default="Airline", alias='@type', constant=True)
boardingPolicy: Optional[Union[List[Union['BoardingPolicyType', str]], 'BoardingPolicyType', str]] = Field(
default=None,
description="The type of boarding policy used by the airline (e.g. zone-based or group-based).",
Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemaorg/Airport.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Airport(CivicStructure):
See: https://schema.org/Airport
Model depth: 4
"""
type_: str = Field(default="Airport", alias='@type')
type_: str = Field(default="Airport", alias='@type', constant=True)
iataCode: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
default=None,
description="IATA identifier for an airline or airport.",
Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemaorg/AlbumRelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class AlbumRelease(MusicAlbumReleaseType):
See: https://schema.org/AlbumRelease
Model depth: 5
"""
type_: str = Field(default="AlbumRelease", alias='@type')
type_: str = Field(default="AlbumRelease", alias='@type', constant=True)

2 changes: 1 addition & 1 deletion pydantic_schemaorg/AlignmentObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AlignmentObject(Intangible):
See: https://schema.org/AlignmentObject
Model depth: 3
"""
type_: str = Field(default="AlignmentObject", alias='@type')
type_: str = Field(default="AlignmentObject", alias='@type', constant=True)
alignmentType: Optional[Union[List[Union[str, 'Text']], str, 'Text']] = Field(
default=None,
description="A category of alignment between the learning resource and the framework node. Recommended"
Expand Down
2 changes: 1 addition & 1 deletion pydantic_schemaorg/AllWheelDriveConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class AllWheelDriveConfiguration(DriveWheelConfigurationValue):
See: https://schema.org/AllWheelDriveConfiguration
Model depth: 6
"""
type_: str = Field(default="AllWheelDriveConfiguration", alias='@type')
type_: str = Field(default="AllWheelDriveConfiguration", alias='@type', constant=True)

Loading

0 comments on commit 4ff4a3a

Please sign in to comment.