kin-openapi
kin-openapi copied to clipboard
Missing Response Header Validation checks except for 'Content-Type'
openapi3filter.ValidateResponse checks only the"Content-Type"header, not performing controls on other header specified in the schema
For example:
info:
version: 1.0.0
title: Test schema
paths:
/:
get:
responses:
'200':
description: A json response
headers:
x-version:
schema:
type: string
content:
application/json:
schema:
type: object
additionalProperties: false
properties:
id:
type: integer
name:
type: string
required:
- id
Should we consider not valid a response missing the "X-Version" header? At the moment is considered valid.
Are you not missing the required field?
headers:
x-version:
required: true
schema:
type: string
Thanks you are right, but fixing the schema I still get a valid response even if the header specified is missing
Indeed AFAICT validation response and request headers against a spec isn't implemented. Care to try?
At the moment this feature is not essential, maybe later I could give it a try :)
I have stumbled upon this library! So far it seems exactly what I need. Thank you!
I need to validate Content-encoding: gzip header in the response, it is required in my spec. Everything is passed, however, the header is not present in the response.
Has something changed since April 2020 or waiting for volunteers to implement it?)
Hi @mariaefi29! I'd be happy to review your pull request.