oatpp / oatpp-swagger

OpenApi 3.0.0 docs + Swagger UI for oatpp services
https://oatpp.io/
Apache License 2.0
90 stars 51 forks source link

Header parameters not shown in Swagger UI #65

Open asiirtol opened 2 years ago

asiirtol commented 2 years ago

Currently, headers parameters are not shown in Swagger UI. The problem is in the line 424 of Generator.cpp: filteredHeaders[header] = info->headers[header]; which uses operator[] instead of add() to insert header parameters. Hence, a possible fix is to change the line to: filteredHeaders.add(header, info->headers[header].type) = info->headers[header];

notorious-PID commented 1 year ago

The issue still persists, are there plans to resolve it? The fix seems simple enough and describing headers is an important swagger feature.

ns-wxin commented 1 month ago

I tried @asiirtol's fix, but the "required" field seems to be ignored when I tried to define an optional header. Now that I have to provide the header otherwise I get an error.