Routes are created such as @router.post("/test-project/v1.2.3/process-file-1") here which is great.
However, the web server should also handle requests to the major-semver-version-only of the path e.g. /test-project/v1/process-file-1 the same way it handles requests to /test-project/v1.2.3/process-file-1 . I haven't found a great way to do this with FastAPI in a Google search or via the LLM's, so I think it would be fine to just wrap the entire block in the jinja template in a two-element for loop -- this is just code generation after all.
Alternatively, something like this is also probably OK:
async def process_file(request: Request):
# your common logic here
return {"message": "File processed successfully"}
@router.post("/test-project/v1.2.3/process-file-1")
async def pipeline_1(request: Request):
return await process_file(request)
@router.post("/test-project/v1/process-file-1")
async def pipeline_2(request: Request):
return await process_file(request)
Definition of Done
Both the major and major.minor.patch routes are accessible from the client, e.g. /test-project/v1/process-file-1 and /test-project/v1.2.3/process-file-1
A unittest shows this working for a least one route
Currently,
Routes are created such as
@router.post("/test-project/v1.2.3/process-file-1")
here which is great.However, the web server should also handle requests to the major-semver-version-only of the path e.g.
/test-project/v1/process-file-1
the same way it handles requests to/test-project/v1.2.3/process-file-1
. I haven't found a great way to do this with FastAPI in a Google search or via the LLM's, so I think it would be fine to just wrap the entire block in the jinja template in a two-element for loop -- this is just code generation after all.Alternatively, something like this is also probably OK:
Definition of Done