Skip to content

Instantly share code, notes, and snippets.

@kymmt90
Created October 4, 2017 16:12
Show Gist options
  • Save kymmt90/bd517aa7806c772dd182bb8b22287e22 to your computer and use it in GitHub Desktop.
Save kymmt90/bd517aa7806c772dd182bb8b22287e22 to your computer and use it in GitHub Desktop.
watching OpenAPI docs
initializer 'watch_open_api_docs' do |app|
app.reloaders << app.config.file_watcher.new([], { Rails.root.join('open_api_docs').to_s => ['yml'] })
config.to_prepare do
yaml = YamlRefResolver.new.resolve!(Rails.root.join('open_api_docs', 'index.yml')).to_yaml
Tempfile.create do |f|
OpenApiParser::Specification.resolve!(f.path)
end
rescue JsonSchema::Error => e
Rails.logger.error e.full_message
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment