The question is if this behaviour is intended or not.
Suppose we have a piece of some swagger.json. At some It contains parameter "AccessKey" which should be passed in header according to the specification.
{
"openapi": "3.0.1",
"info": {
"title": "Client info API",
"description": "CRM loyalty",
"termsOfService": "https://example.com",
"contact": {
"name": "Some Contact",
"url": "https://example.com",
"email": "info@example.com"
},
"version": "v3"
},
"paths": {
"/api/v3/clients/accesstoken": {
"post": {
"tags": [
"ClientsV3"
],
"summary": "Creates client token",
"description": "Token to be used to obtain a concrete client info",
"parameters": [
{
"name": "AccessKey",
"in": "header",
"description": "API access key",
"schema": {
"type": "string",
"description": "API access key",
"nullable": true
}
}
],
"requestBody": {
...
Everything generates fine except for header param. As a walk-around it is possible to use custom configuration for APIClient.
let config = URLSessionConfiguration.default
config.httpAdditionalHeaders = ["AccessKey" : accessKey]
api = APIClient(configuration: APIClient.Configuration(baseURL: baseURL, sessionConfiguration: config))
This is totally fine in some cases. But if looks like in general those parameters should be reflected somehow in generated API. At least optionally.
Used API Version 0.2.0.
The question is if this behaviour is intended or not.
Suppose we have a piece of some
swagger.json. At some It contains parameter "AccessKey" which should be passed in header according to the specification.{ "openapi": "3.0.1", "info": { "title": "Client info API", "description": "CRM loyalty", "termsOfService": "https://example.com", "contact": { "name": "Some Contact", "url": "https://example.com", "email": "info@example.com" }, "version": "v3" }, "paths": { "/api/v3/clients/accesstoken": { "post": { "tags": [ "ClientsV3" ], "summary": "Creates client token", "description": "Token to be used to obtain a concrete client info", "parameters": [ { "name": "AccessKey", "in": "header", "description": "API access key", "schema": { "type": "string", "description": "API access key", "nullable": true } } ], "requestBody": { ...Everything generates fine except for header param. As a walk-around it is possible to use custom configuration for
APIClient.This is totally fine in some cases. But if looks like in general those parameters should be reflected somehow in generated API. At least optionally.
Used API Version 0.2.0.