Sha256: 51ba482f8381c8c9b858023676707bd8f8bdbd08320db57e322247dff3a97436

Contents?: true

Size: 390 Bytes

Versions: 5

Compression:

Stored size: 390 Bytes

Contents

# frozen_string_literal: true

class BasicSerializer
  module Swagger
    def swagger_ref
      @schema_ref || "#/components/schemas/#{custom_model_name}"
    end

    def swagger_schema
      hash = {
        type: "object",
        properties: {}
      }

      attributes.each_pair do |name, type|
        hash[:properties][name] = { type: type }
      end

      hash
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
basic_serializer-0.1.7 lib/basic_serializer/swagger.rb
basic_serializer-0.1.6 lib/basic_serializer/swagger.rb
basic_serializer-0.1.5 lib/basic_serializer/swagger.rb
basic_serializer-0.1.4 lib/basic_serializer/swagger.rb
basic_serializer-0.1.3 lib/basic_serializer/swagger.rb