Sha256: 1dcbf6abef0ff8cc824119ce37f4df99fcd4724a7c4aa907dd957bacfaa4521f
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
module Swagger # A class that represents an Object defined in the Swagger specification. # Provides methods for defining fields in the object. class SwaggerObject < Hashie::Dash include Hashie::Extensions::Coercion include Hashie::Extensions::IndifferentAccess include Swagger::Attachable attr_accessor :parent # @api private # Initializes a Swagger object, using Hashie::Dash, # and attaches to children objects so navigation via +parent+ # and +root+ is possible. def initialize(hash) super attach_to_children end # @api private # @!macro [attach] field # @!attribute [rw] $1 # Swagger field $1. $3 # @return [$2] # Defines a Swagger field on a class. def self.field(name, type, opts = {}) property name, opts coerce_key name, type end # @api private # @!macro [attach] required_field # @!attribute [rw] $1 # **Required** Swagger field $1. $3 # @return [$2] # Defines a required Swagger field on a class. def self.required_field(name, type, opts = {}) opts[:required] = true field(name, type, opts) end end end
Version data entries
4 entries across 4 versions & 1 rubygems