Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: repair how multiple examples are declared in web_api #243

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions readalongs/web_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,26 @@ async def langs() -> List[SupportedLanguage]:
@v1.post("/assemble", response_model=AssembleResponse)
async def assemble(
request: AssembleRequest = Body(
examples=[
{
"text": {
"summary": "A basic example with plain text input",
"value": {
"input": "hej verden",
"type": "text/plain",
"text_languages": ["dan", "und"],
"debug": False,
},
openapi_examples={
"text": {
"summary": "A basic example with plain text input",
"value": {
"input": "hej verden",
"type": "text/plain",
"text_languages": ["dan", "und"],
"debug": False,
},
"xml": {
"summary": "A basic example with xml input",
"value": {
"input": "<?xml version='1.0' encoding='utf-8'?><read-along version=\"1.0\"><text><p><s>hej verden</s></p></text></read-along>",
"type": "application/readalong+xml",
"text_languages": ["dan", "und"],
"debug": False,
},
},
"xml": {
"summary": "A basic example with xml input",
"value": {
"input": "<?xml version='1.0' encoding='utf-8'?><read-along version=\"1.0\"><text><p><s>hej verden</s></p></text></read-along>",
"type": "application/readalong+xml",
"text_languages": ["dan", "und"],
"debug": False,
},
}
]
},
}
),
):
"""Create an input RAS from the given text (as plain text or XML).
Expand Down Expand Up @@ -331,7 +329,7 @@ class ConvertRequest(BaseModel):
"""\
<?xml version='1.0' encoding='utf-8'?>
<read-along version="%s">
<meta name="generator" content="@readalongs/studio (cli) %s"/>
<meta name="generator" content="@readalongs/studio (cli) %s"/>
<text xml:lang="dan" fallback-langs="und" id="t0">
<body id="t0b0">
<div type="page" id="t0b0d0">
Expand Down
2 changes: 1 addition & 1 deletion requirements.min.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
chevron==0.14.0
click>=8.0.4
coloredlogs>=10.0
fastapi>=0.100.0
fastapi>=0.103.0
g2p>=1.1.20230822, <3
lxml==4.9.4
numpy>=1.20.2
Expand Down
Loading