rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

Curl is incorrect when using relative spec-url #15

Closed croudet closed 5 years ago

croudet commented 5 years ago

When using relative spec-url the curl is missing the server part:

<rapi-doc id="rapidoc" show-header="false" theme="dark" layout="row" spec-url="/swagger/spec-1.0.yml"></rapi-doc>
curl -X GET "/ds/assets?"
mrin9 commented 5 years ago

can you confirm if servers or host is specified in the spec ?

I am trying out https://mrin9.github.io/RapiDoc/example1.html and providing a relative path as ./petstore_spec.json its working out fine for me

croudet commented 5 years ago

There is no servers or host in the spec file.

mrin9 commented 5 years ago

Is your, 'TRY' API call working ?

However, If it is missing in the spec, and you dont have any control on the spec, you can define the server in the <rapi-doc> element using server attribute

Let me know, if this is not the solution you like to settle for and have any alternate suggestion

croudet commented 5 years ago

The Try API calls are working. The same spec file with swagger-ui gives : curl -X GET "http://<server>:<port>/ds/assets" -H "accept: */*"

mrin9 commented 5 years ago

Can you help find out the url generated by swagger-ui is relative to where you are hosting the .html or the API spec

Say your html is at http://example.com/api-doc.html and your spec is at http://example.com/spec/petstore.json .

<rapi-docs> The Try API uses the .html's location

croudet commented 5 years ago

The spec is hosted on the same server as the html. It is specified by a relative url: <rapi-doc id="rapidoc" show-header="false" theme="dark" layout="row" spec-url="/swagger/diff-server-1.0.yml"/>

mrin9 commented 5 years ago

released 4.2.4, which should take care of this issue. Feel free to re-open in case it isnt working the way you expect it to be

on the side note, custom-elements should not be self-closed https://stackoverflow.com/questions/23961178/do-custom-elements-require-a-close-tag