Sha256: fa8f4ed88d66846b64b978f5e6b9ebb4a5de2a4786ddd2d21bb7676057791438
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 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, data: { }, type: nil self[:responses][code] = ResponseObj.new(desc) unless (self[:responses] ||= { })[code].is_a?(ResponseObj) self[:responses][code].add_or_fusion(media_type, { data: type || data }) end alias_method :resp, :response alias_method :error, :response end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
zero-rails_openapi-1.5.2 | lib/open_api/dsl/common_dsl.rb |
zero-rails_openapi-1.5.1 | lib/open_api/dsl/common_dsl.rb |
zero-rails_openapi-1.4.3 | lib/open_api/dsl/common_dsl.rb |