Giter Club home page Giter Club logo

Comments (4)

ikalnytskyi avatar ikalnytskyi commented on August 30, 2024

@sn4kebite sorry for the late reply, I've been busy lately. :(

I'm not quite sure I understand your use case correctly. Could you please elaborate? For what purpose exactly you want to use relative HTTP URL? I mean, if you specify a path on filesystem, the spec would be copied to output directory and relative URL would be used automatically.

from redoc.

ikalnytskyi avatar ikalnytskyi commented on August 30, 2024

Alternatively, in some cases (when only domain is changed), you may use something like:

    'spec': 'http:///api/rest/spec.yaml',

which will try to download the spec from /api/rest/spec.yaml from the same domain.

Please respond whether it worked for you or not.

from redoc.

sn4kebite avatar sn4kebite commented on August 30, 2024

I am building a docker image containing both API and documentation. The spec.yaml file is not available when the documentation is being built, as it is generated by the API on demand.

From what I understand this is when you want to use an HTTP URL to the spec, however I don't know the URL in advance. The spec can however be found relative to the docs, so using a relative URL in this case solves this problem.

Using the HTTP URL without hostname is a neat trick (I didn't know you could do that), but I'm concerned how well supported it is (no results on google that I could find), and it only works with either http or https.

from redoc.

ikalnytskyi avatar ikalnytskyi commented on August 30, 2024

Using the HTTP URL without hostname is a neat trick (I didn't know you could do that), but I'm concerned how well supported it is (no results on google that I could find),

Well, honestly, I don't know; this is behaviour I observe in Python when you do urljoin.

and it only works with either http or https.

A doubt Redoc.js support any other protocol except for HTTP(s). It's a limitation of JS machines in browsers.

Still I do understand your use case now. I'm thinking about fallbacking to HTTP relative URI if the corresponding file wasn't found. I.e.

  • You would still have something like

     'spec': '/api/rest/spec.yaml',
  • The extension will try to find a file of filesystem first.

  • If found, it will be copied over to output directory.

  • If not found, the extension would pass /api/rest/spec.yaml "As Is" to Redoc.js.

from redoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.