Sha256: 01643bdee5f2758038afff2f617c1c1c33dd158617e72599bd87aef0607798a8

Contents?: true

Size: 894 Bytes

Versions: 6

Compression:

Stored size: 894 Bytes

Contents

require "json/schema/serializer"
require_relative "./schema_accessor"
require_relative "./media_type/deserializer"
require_relative "./media_type/validator"

module Swagger
  class Schema
    class MediaType
      extend SchemaAccessor

      def initialize(schema)
        @schema = schema
      end

      define_schema_accessor :schema, :example, :examples, :encoding

      def serializer(options = {}, store = true)
        use_options = store ? Swagger::Serializer::Store.current.serialize_options.merge(options) : options
        JSON::Schema::Serializer.new(schema, use_options)
      end

      def deserializer(options = {}, store = true)
        use_options = store ? Swagger::Serializer::Store.current.deserialize_options.merge(options) : options
        Deserializer.new(schema, use_options)
      end

      def validator
        Validator.new(schema)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
swagger-serializer-0.9.1 lib/swagger/schema/media_type.rb
swagger-serializer-0.9.0 lib/swagger/schema/media_type.rb
swagger-serializer-0.8.3 lib/swagger/schema/media_type.rb
swagger-serializer-0.8.2 lib/swagger/schema/media_type.rb
swagger-serializer-0.8.1 lib/swagger/schema/media_type.rb
swagger-serializer-0.8.0 lib/swagger/schema/media_type.rb