Skip to content

Cannot use headers AND content in responses #829

@ricardojosegomezulmke

Description

@ricardojosegomezulmke

Currently generated code returns either 1 (one) response header or the body as defined in spec.
But it cannot return BOTH, headers AND body.

Example from sample spec v3:
GET /user/login
responses 200:
"responses": {
"200": {
"description": "successful operation",
"headers": {
"X-Rate-Limit": {
"description": "calls per hour allowed by the user",
"schema": {
"type": "integer",
"format": "int32"
}
},
"X-Expires-After": {
"description": "date in UTC when toekn expires",
"schema": {
"type": "string",
"format": "date-time"
}
}
},
"content": {
"application/xml": {
"schema": {
"type": "string"
}
},
"application/json": {
"schema": {
"type": "string"
}
}
}
},

In the example, the generated user login service will only return the content. There is no mechanism to get the headers
X-Rate-Limit or X-Expires-After.
The only way to achieve this today is to specify 3 services, e.g.:
GET /user/login => returns the content
GET /user/login/x-rate-limit: specify ONLY the header X-Rate-Limit
GET /user/login/x-expires-after: specify ONLY the header X-Expires-After

and make 3 calls.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions