biopragmatics / curies

🐸 Idiomatic conversion between URIs and compact URIs (CURIEs) in Python
https://curies.readthedocs.io
MIT License
21 stars 6 forks source link

Add model for list of records #70

Closed cthoyt closed 9 months ago

cthoyt commented 1 year ago

Using Custom Root Types, Pydantic allows for defining models based on a derived Python type. As an extended prefix map is just a list of a records, it can be defined with the following:

class Records(BaseModel):
    __root__ = List[Record]

ideally, additional metadata is added such that better JSON schema / FastAPI endpoints can be generated using this