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

Support OpenAPI 3 servers specification #121

Open
kiranshila opened this issue Aug 7, 2021 · 6 comments
Open

Support OpenAPI 3 servers specification #121

kiranshila opened this issue Aug 7, 2021 · 6 comments

Comments

@kiranshila
Copy link

I am pretty new to swagger/openapi in general so please bear with me if this is already solved - I couldn't quite tell if it was the case.
I am trying to use this library with Radarr's OpenAPI and am having some problems. Their API is OpenAPI 3, specifically with a servers section as such:

  "servers": [
    {
      "url": "{protocol}://{hostPath}/api/v3",
      "variables": {
        "protocol": {
          "enum": ["https", "http"],
          "default": "https"
        },
        "hostPath": {
          "default": "localhost:7878",
          "description": "Your Radarr Server URL"
        }
      }
    }
  ],

However, trying martian/url-for on one of the endpoints, say :get-movie results in the peculiar URL https://raw.githubusercontent.com{protocol}://{hostPath}/api/v3/movie

Any help would be appreciated as to how to use the servers section of the api with this library. Fantastic work on this, by the way, this library is quite wonderful!

@kiranshila
Copy link
Author

Also, I am bootstrapping with

(def radarr-api
 (martian-http/bootstrap-openapi "https://raw.githubusercontent.com/Radarr/Radarr/develop/src/Radarr.Api.V3/swagger.json"))

@oliyh
Copy link
Owner

oliyh commented Aug 15, 2021

Hi,

This is not currently supported in Martian. It probably could be without too much trouble. I'll have to do some reading on what that section means, but probably a first pass to just use the defaults would at least get you able to use it.

Thanks for reporting.

@oliyh
Copy link
Owner

oliyh commented Jan 25, 2022

Hi,

In #129 support was added for an option :server-url in the options when you call bootstrap-openapi. You could change to this as a workaround:

(def radarr-api
 (martian-http/bootstrap-openapi 
    "https://raw.githubusercontent.com/Radarr/Radarr/develop/src/Radarr.Api.V3/swagger.json"
    {:server-url "https://localhost:7878/api/v3"}))

This is available in the latest snapshot 0.1.21-SNAPSHOT

@arichiardi
Copy link

A question, I have been eyeing this project for loading our OpenAPI 3 spec, is it, in general, supported by martian?

@oliyh
Copy link
Owner

oliyh commented Oct 18, 2022

Hi @arichiardi ,

The OpenAPI spec is in general supported by martian, this was added in #90 and #91 with various extra bits added since. This issue in particular is still unaddressed and there are likely other small parts that are not supported but you should find that core functionality is all there.

If you find something missing, issues and PRs are welcome as always.

Cheers

@damesek
Copy link

damesek commented Sep 14, 2023

Please add to Readme this :server-url option. :)
It took me a long time to find this here..

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

4 participants