Class: GrapeOAS::Rake::OasTasks

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/grape_oas/rake/oas_tasks.rb

Overview

Rake tasks for generating and validating OpenAPI documentation.

Examples:

Usage in Rakefile

require 'grape_oas/rake/oas_tasks'
GrapeOAS::Rake::OasTasks.new(MyAPI)

With options

GrapeOAS::Rake::OasTasks.new(MyAPI, schema_type: :oas31, title: "My API")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_class, **options) ⇒ OasTasks

Returns a new instance of OasTasks.

Parameters:

  • api_class (Class, String)

    The Grape API class or its name as a string

  • options (Hash)

    Options passed to GrapeOAS.generate



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/grape_oas/rake/oas_tasks.rb', line 23

def initialize(api_class, **options)
  super()

  if api_class.is_a?(String)
    @api_class_name = api_class
  else
    @api_class = api_class
  end

  @options = options
  define_tasks
end

Instance Attribute Details

#api_classObject (readonly)

Returns the value of attribute api_class.



19
20
21
# File 'lib/grape_oas/rake/oas_tasks.rb', line 19

def api_class
  @api_class
end

#optionsObject (readonly)

Returns the value of attribute options.



19
20
21
# File 'lib/grape_oas/rake/oas_tasks.rb', line 19

def options
  @options
end