Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

254
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!