Skip to content

blurry-dev/pydantic2-schemaorg

 
 

Repository files navigation

pydantic2_schemaorg

PyPi version

Use Schema.org types in pydantic!

pydantic2_schemaorg contains all the models defined by schema.org. The pydantic classes are auto-generated from the schema.org model definitions that can be found on https://schema.org/version/latest/schemaorg-current-https.jsonld

Requirements

Works with python >= 3.10

How to install

pip install pydantic2-schemaorg

Import any class you want to use by with the following convention

from pydantic2_schemaorg.<SCHEMAORG_MODEL_NAME> import <SCHEMAORG_MODEL_NAME>

A full (hierarchical) list of Schema.org model names can be found here

Example usages

from pydantic2_schemaorg.ScholarlyArticle import ScholarlyArticle

scholarly_article = ScholarlyArticle(
    url='https://github.com/blurry-dev/pydantic2-schemaorg/pydantic2_schemaorg',
    sameAs='https://github.com/blurry-dev/pydantic2-schemaorg/pydantic2_schemaorg',
    copyrightNotice='Free to use under the MIT license',
    dateCreated='15-12-2021'
)
print(scholarly_article.json())
{"@type": "ScholarlyArticle", "url": "https://github.com/blurry-dev/pydantic2-schemaorg/pydantic2_schemaorg", "sameAs": "https://github.com/blurry-dev/pydantic2-schemaorg/pydantic2_schemaorg", "copyrightNotice": "Free to use under the MIT license", "dateCreated": "15-12-2021"}

Packages

No packages published

Languages

  • Python 99.7%
  • Smarty 0.3%