Hi,
I have been using the nitrokey/nethsm:testing docker image for testing my API client library in Go.
Today I regenerated REST code using OpenAPI Generator and the https://nethsmdemo.nitrokey.com/api_docs/nethsm-api.yaml OpenAPI specification and noticed that the nethsm-api.yaml file has probably changed a bit so that, for instance, this call:
/keys/{KeyID}/csr.pem:
post:
responses:
"200":
description: Successful generation of certificate signing request.
content:
application/x-pem-file:
schema:
$ref: "#/components/schemas/PemCSR"
"400":
description: Bad request (specified properties are invalid).
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"401":
description: Authentication required but none provided.
"403":
description: Access denied.
"404":
description: Key for KeyID not found in namespace.
"406":
description: Content type in Accept header not supported.
"412":
description: Precondition failed (NetHSM was not *Operational*).
now results in a client that will accept application/x-pem-file AND application/json where before it would only accept application/x-pem-file.
So when I run my tests against the Docker test container the response I get is a 406 Content type in Accept header not supported. Which suggests to me that the Docker image (or the HSM software) and the API definition are not entirely in sync.
I’m not quite sure how to address this. For now I think I’ll keep the generated code made from what I assume is an older version of the OpenAPI spec.
I think it could be helpful if different versions of the OpenAPI spec were published under a filename that has the version of the OpenAPI in it so it is possible to use a specific version when generating code.
Is it possible to make the HSM software be somewhat more tolerant of Accept headers?