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