Open spinenkoia opened 2 years ago
Calling an endpoint and not specifying the value for an array query parameter results in handler receiving ['']
For example , when requesting curl -i -X GET "http://127.0.0.1:8080/test?ids=" in the handler, instead of [] I get ["]
curl -i -X GET "http://127.0.0.1:8080/test?ids="
Steps to reproduce swagger.yaml
openapi: 2.0.0 info: version: 1.0 paths: /test: get: operationId: test_handler parameters: - name: ids required: false in: query type: array collectionFormat: csv items: type: string format: uuid responses: "200"
main.py
from typing import List from aiohttp.web import Application, run_app from aiohttp.web import Request, Response from aiohttp_apiset import SwaggerRouter from aiohttp_apiset.middlewares import jsonify from aiohttp_apiset.swagger.operations import OperationIdMapping async def test_handler(request: Request, ids: List[str]) -> Response: print(f"Received list: {ids}") return Response() def main(): router = SwaggerRouter( swagger_ui='/swagger/', search_dirs=['./'], ) app = Application(router=router, middlewares=[jsonify]) opmap = OperationIdMapping(test_handler=test_handler) router.include(spec='swagger.yaml', operationId_mapping=opmap) run_app(app) if __name__ == "__main__": main()
Python version: 3.10.2 aiohttp_apiset vesion: 0.9.15
Calling an endpoint and not specifying the value for an array query parameter results in handler receiving ['']
For example , when requesting
curl -i -X GET "http://127.0.0.1:8080/test?ids="
in the handler, instead of [] I get ["]Steps to reproduce swagger.yaml
main.py
Python version: 3.10.2 aiohttp_apiset vesion: 0.9.15