martian
martian copied to clipboard
Unable to use martian over spotinst API
I've been trying to use the Martian library for the following openapi spec https://docs.spot.io/api/
The regular bootstrap-openapi requires a HTTP endpoint to get the schema however there is no endpoint as such for spotinst. so i had to handroll my own bootstrap that prepares the definition from the map
Anyway, once I had the martian object bootstrapped I had the following issue
Taking the following path from the openapi
"paths": {
"/aws/ec2/group": {
"summary": "Elastigroups for AWS",
"post": {
"summary": "Create Elastigroup",
It has 1 Query parameter accountId
and a requestBody of type #/components/schemas/elastigroupCreate
However when I do a explore for elastigroup-aws-create
I get the following
{:summary "Create Elastigroup", :parameters {:account-id java.lang.String, :body Any}, :returns {200 Any, 400 nil}}
Why is the body of type Any
? This results in any map being accepted and eventually the server returns with a validation error
Please note, there is a bug in the spotinst openapi line number 67726. it needs to be an integer instead of string
this was another major problem that took me so long to debug. bootstrap-openapi returned fine however upon using explore
, I used to get a schema validation error because the default value didn't conform to the spec
Hello,
I suspect it is the "allOf" schema combinator that Martian doesn't understand, unless you have a counterexample?
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/elastigroupCreate"
}
]
}
}
}
},
no I don't and you may be right in that case :( any idea of the work involved to support it?
Might not be too bad, but I'm a bit short on time at the moment. I'll try to find time to look soon.