Closed vincentsarago closed 10 months ago
🤔 well it's not directly the same as https://github.com/tiangolo/fastapi/discussions/8420 because this simple example
from fastapi import Depends, FastAPI, Query
from dataclasses import dataclass
from typing import List, Optional
from typing_extensions import Annotated
app = FastAPI()
@dataclass
class CommonQueryParams:
stuff: Annotated[
Optional[List[str]],
Query(
title="stuff",
description="some stuff.",
examples={
"example1": {
"description": "example for stuff 1.",
"value": ["stuffffff"],
},
"example2": {
"description": "example for stuff 2.",
"value": ["stuffffff", "stuffffff"],
},
},
),
] = None
@app.get('/using-model')
async def using_model(
query: CommonQueryParams = Depends()
):
pass
@app.get('/using-func')
async def using_func(
stuff: Annotated[
Optional[List[str]],
Query(
title="stuff",
description="some stuff.",
examples={
"example1": {
"description": "example for stuff 1.",
"value": ["stuffffff"],
},
"example2": {
"description": "example for stuff 2.",
"value": ["stuffffff", "stuffffff"],
},
},
),
] = None,
):
pass
returns the same things for both methods, so using a class or a direct reference do not change the output
solution is to rename examples
-> openapi_examples
Just seeing this right now but it seems it's been quite some time now.
In ☝️ we should see
examples
and also have abilities to enter multiple entries forList
parameters likehttps://github.com/developmentseed/titiler/blob/75c94de2227059f13762dcf2d91c6c5fb5f708fc/src/titiler/core/titiler/core/dependencies.py#L78-L91
ref: https://github.com/tiangolo/fastapi/discussions/8420