Sha256: f44db737ce6dd594c544dd2409fba9006834526e91c1c50ba1f0a0c48e975450

Contents?: true

Size: 599 Bytes

Versions: 11

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true

require_relative '../schemas/dynamic_schema'

module Meta
  module JsonSchema
    class DynamicSchemaBuilder
      def initialize(options)
        options = options.dup
        @dynamic_schema_options = options.delete(:dynamic_ref)
        @base_options = options
      end

      def to_schema
        DynamicSchema.new(
          @dynamic_schema_options[:resolve],
          one_of: @dynamic_schema_options[:one_of] && @dynamic_schema_options[:one_of].map { |schema| RefSchema.new(schema.to_schema) },
          **@base_options
        )
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
meta-api-0.2.0 lib//meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.1.2 lib//meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.1.1 lib//meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.1.0 lib//meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.0.9 lib//meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.0.8 lib/meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.0.7 lib/meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.0.6 lib/meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.0.5 lib/meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.0.4 lib/meta/json_schema/builders/dynamic_schema_builder.rb
meta-api-0.0.3 lib/meta/json_schema/builders/dynamic_schema_builder.rb