I'm guessing there will likely be other endpoints that violate spec like this, and the API should be reviewed top to bottom.
I'm trying to implement rdns routines:
Code
$ go run cmd/netcup/main.go rdns delete ...
$ go run cmd/netcup/main.go rdns get ...
Error: decode response: decode application/hal+json: decode RdnsIpv4: callback: decode field "rdns": unexpected byte 110 'n' at 8
exit status 1
When I look at the actual response directly:
Code
$ curl -s -H "Accept: application/hal+json" \
-H "Authorization: Bearer $(go run cmd/netcup/main.go auth print-access-token)" \
-X 'GET' \
'https://servercontrolpanel.de/scp-core/api/v1/rdns/ipv4/...' | jq
{
"rdns": null
}
This is a problem because the OpenAPI spec does not say this is possible.
Code
$ jq '.components.schemas.RdnsIpv4' openapi.json
{
"type": "object",
"properties": {
"rdns": {
"type": "string"
}
}
}
The spec is missing a nullable which you can read about here: https://swagger.io/docs/specifica…ata-types/#null
Because the string data type is missing a nullable attribute, OpenAPI generator tools, like ogen in my case, generates:
Which only allows this field to be a string or absent, but not null.