Skip to content

Instantly share code, notes, and snippets.

@tinacious
Created April 25, 2021 00:52
Show Gist options
  • Save tinacious/2c479a164d33067258b9d1322350907b to your computer and use it in GitHub Desktop.
Save tinacious/2c479a164d33067258b9d1322350907b to your computer and use it in GitHub Desktop.
Adds branding to Swagger/Open API docs
#!/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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment