Sha256: 7d9963ebae7920d08af51c2a0df984f2ce11599c572acc20aa88543e9baf4fba

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 Bytes

Contents

# frozen_string_literal: true

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

    def swagger_schema
      @swagger_schema ||= build_swagger_schema
    end

    private

    def build_swagger_schema
      {
        type: "object",
        properties: build_properties
      }
    end

    def build_properties
      attributes.transform_values do |type|
        { type: type }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
basic_serializer-0.1.8 lib/basic_serializer/swagger.rb