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

Feature Request: Support Open API Extensions for branding purposes #56

Open
tinacious opened this issue Apr 25, 2021 · 0 comments
Open

Comments

@tinacious
Copy link

tinacious commented Apr 25, 2021

Thanks for this great library! 🙏

Open API Extensions are supported by some doc generators like Redoc and allow us to add branding, e.g. x-logo. It would be great if we can add this in the Dox configuration, perhaps namespaced under extensions or similar, for example:

Dox.configure do |config|
  # ...

  config.extensions['x-logo'] = {
    "url": "https://example.com/logo.png",
    "backgroundColor": "#ff3399"
  }

  # ...
end

I was able to add support for automated branding afterwards with the following script:

#!/usr/local/bin/ruby
require 'json'

docs = File.read('spec/api_doc/v1/schemas/docs.json')
docs_json = JSON.parse(docs)

docs_json['info']['x-logo'] = {
  "url": "https://example.com/logo.png",
  "backgroundColor": "#ff3399"
}

updated_docs = JSON.pretty_generate(docs_json)

File.write('spec/api_doc/v1/schemas/docs.json', updated_docs)

Script reference

Thanks again for all your great work on this library.

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

1 participant