Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.01 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.01 KB

structured_params-openapi

English | 日本語

OpenAPI drift check for StructuredParams. It detects differences between OpenAPI request schemas and StructuredParams::Params classes, so a change on one side cannot silently diverge from the other.

Installation

# Gemfile
gem 'structured_params-openapi'

Bundler requires it automatically (structured_params/openapi). In a Rails application the Rake task structured_params:openapi:drift_check is registered for you.

Usage

# config/initializers/structured_params_openapi.rb
StructuredParams::OpenAPI.configure do |config|
  config.document = Rails.root.join('docs/api/openapi.yaml').to_s
  config.parameter_class_filter = ->(klass) { klass.name&.start_with?('Api::') }
end
bundle exec rake structured_params:openapi:drift_check

See the guide for naming conventions, multiple OpenAPI files, ignoring findings, and the supported schema features.