Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

256
Vistas
FastAPI - Add description for path parameter in swagger

Imagine there is an app like that:

from fastapi import FastAPI

app = FastAPI()


@app.get("/items/{item_id}")
async def read_item(item_id: int):
    return {"item_id": item_id}

How could one add description for path parameter item_id in swagger?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Like this

@app.get("/items/{item_id}")
async def read_item(item_id: int):
    """
    item_id: Your item ID description will be here
    """
    return {"item_id": item_id}
    

swagger doc enter image description here

over 4 years ago · Santiago Trujillo Denunciar

0

You can add description for a specific parameter by using the description argument to the parameter type object:

item_id: int = Path(..., description="An id representing an item")

The ... represents the default value and should be included.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda