Feat: support adding headers from oas in o2k#277
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #277 +/- ##
=======================================
Coverage ? 70.26%
=======================================
Files ? 24
Lines ? 3541
Branches ? 0
=======================================
Hits ? 2488
Misses ? 874
Partials ? 179 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9c43d59 to
07f34fd
Compare
|
|
||
| // Returns header parameters which can be used for routing for an operation | ||
| func findHeaderParamsForRouting( | ||
| operationLevelParameters []*v3.Parameter, |
There was a problem hiding this comment.
@Prashansa-K I need some input here - do you think it's better if we also expect required: true for the headers we include in the route in kong config based on the enum values?
There was a problem hiding this comment.
I don't think we have that restriction with other types (like in: path). We should follow the same here.
Any specific reason you feel that required: true would be useful?
There was a problem hiding this comment.
In path, it is implied that the parameters are required
Headers parameters are optional.
On second thought, since we are generating routes with headers in criteria, those would only match when in the incoming request to gateway, header has a value and the value matches criteria - so it's not necessary for us to only consider required headers.
|
In this PR, we are only dealing with "enums". Other types like oneOf, anyOf, allOf, etc. are not dealt here. Are those not in scope of the task? |
|
@Prashansa-K while the OAS technically allows We can consider it in future - what do you think? |
Sounds good. I was just ensuring the scope of the work. We can get back to the other types when the need arises. |
Summary:
If users have declared header parameters, and their values (in an enum) in the OAS - we will be including those in the generated routes.
Note - some decisions that need attention:
defaultin OAS meant to be assumed by the server when a value is not provided (source) - a incoming HTTP request may or may not contain a value for a header. For now, wherever enum is defined for a header param in OAS, we are creating kong routes with headers, but none without headers.Implements: Kong/deck#1702
Related conversation: https://kongstrong.slack.com/archives/C07AQH7SAF8/p1756099922036849