Sha256: 64fcdba2c334231b331c541e6942089481f300aa112f3bd17a58d68a365cd15d
Contents?: true
Size: 795 Bytes
Versions: 7
Compression:
Stored size: 795 Bytes
Contents
# frozen_string_literal: true require 'json-schema' module RopenPi module Specs class ExtendedTypeAttribute < JSON::Schema::TypeV4Attribute def self.validate(current_schema, data, fragments, processor, validator, options = {}) schema_nullable = (current_schema.schema['nullable'] == true || current_schema.schema['x-nullable'] == true) return if data.nil? && schema_nullable super end end class ExtendedSchema < JSON::Schema::Draft4 def initialize super @attributes['type'] = ExtendedTypeAttribute temp_uri = 'http://tempuri.org/rswag/specs/extended_schema' @uri = URI.parse(temp_uri) @names = [temp_uri] end end JSON::Validator.register_validator(ExtendedSchema.new) end end
Version data entries
7 entries across 7 versions & 1 rubygems