Skip to content

Commit

Permalink
fix: with pydantic 2, Field only takes examples plural
Browse files Browse the repository at this point in the history
Fixes the deprecation warnings part of #215
  • Loading branch information
joanise committed Apr 23, 2024
1 parent 8ab8de1 commit 06d9b17
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions readalongs/web_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,32 +316,34 @@ class ConvertRequest(BaseModel):
"""Convert Request contains the RAS-processed XML"""

dur: Union[float, None] = Field(
example=2.01,
examples=[2.01],
gt=0.0,
title="The duration of the audio used to create the alignment, in seconds.",
default=None,
)

ras: str = Field(
title="The time-aligned XML output produced by `readalongs align`.",
example=dedent(
"""\
<?xml version='1.0' encoding='utf-8'?>
<read-along version="1.0">
<text xml:lang="dan" fallback-langs="und" id="t0">
<body id="t0b0">
<div type="page" id="t0b0d0">
<p id="t0b0d0p0">
<s id="t0b0d0p0s0">
<w id="t0b0d0p0s0w0" ARPABET="HH EH Y" time="0.14" dur="0.64">hej</w>
<w id="t0b0d0p0s0w1" ARPABET="V Y D EH N" time="0.78" dur="1.11">verden</w>
</s>
</p>
</div>
</body>
</text>
</read-along>"""
),
examples=[
dedent(
"""\
<?xml version='1.0' encoding='utf-8'?>
<read-along version="1.0">
<text xml:lang="dan" fallback-langs="und" id="t0">
<body id="t0b0">
<div type="page" id="t0b0d0">
<p id="t0b0d0p0">
<s id="t0b0d0p0s0">
<w id="t0b0d0p0s0w0" ARPABET="HH EH Y" time="0.14" dur="0.64">hej</w>
<w id="t0b0d0p0s0w1" ARPABET="V Y D EH N" time="0.78" dur="1.11">verden</w>
</s>
</p>
</div>
</body>
</text>
</read-along>"""
)
],
)


Expand Down

0 comments on commit 06d9b17

Please sign in to comment.