Sha256: c2acc0197125c4e9e5c86076beadaf31934c1f66a754e1740d8522f523f11ea2
Contents?: true
Size: 1.43 KB
Versions: 3
Compression:
Stored size: 1.43 KB
Contents
require 'oas_objs/schema_obj' require 'oas_objs/combined_schema' require 'oas_objs/param_obj' require 'oas_objs/response_obj' require 'oas_objs/request_body_obj' require 'oas_objs/ref_obj' require 'oas_objs/example_obj' require 'open_api/dsl/helpers' module OpenApi module DSL module CommonDSL %i[ header header! path path! query query! cookie cookie! ].each do |param_type| define_method param_type do |*args| @param_type = param_type _param_agent *args end end %i[ body body! ].each do |method| define_method method do |*args| @method_name = method _request_body_agent *args end end # `code`: when defining components, `code` means `component_key` def response code, desc, media_type = nil, hash = { } (self[:responses] ||= { })[code] = ResponseObj.new(desc, media_type, hash) end def default_response desc, media_type = nil, hash = { } response :default, desc, media_type, hash end { # alias_methods mapping response: %i[ error_response resp ], default_response: %i[ dft_resp dft_response ], error_response: %i[ other_response oth_resp error err_resp ], }.each do |original_name, aliases| aliases.each do |alias_name| alias_method alias_name, original_name end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
zero-rails_openapi-1.4.2 | lib/open_api/dsl/common_dsl.rb |
zero-rails_openapi-1.4.1 | lib/open_api/dsl/common_dsl.rb |
zero-rails_openapi-1.4.0 | lib/open_api/dsl/common_dsl.rb |