Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use martian over spotinst API #169

Open
fhalde opened this issue Mar 24, 2023 · 4 comments
Open

Unable to use martian over spotinst API #169

fhalde opened this issue Mar 24, 2023 · 4 comments

Comments

@fhalde
Copy link

fhalde commented Mar 24, 2023

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

@fhalde
Copy link
Author

fhalde commented Mar 24, 2023

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

@oliyh
Copy link
Owner

oliyh commented Mar 24, 2023

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"
                  }
                ]
              }
            }
          }
        },

@fhalde
Copy link
Author

fhalde commented Mar 27, 2023

no I don't and you may be right in that case :( any idea of the work involved to support it?

@oliyh
Copy link
Owner

oliyh commented Mar 27, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants