module OpenApiAnnotator::ControllerAnnotatable
Public Instance Methods
endpoint(type)
click to toggle source
# File lib/open_api_annotator/controller_annotatable.rb, line 12 def endpoint(type) validate_open_api_type!(type) @last_endpoint = Endpoint.new(type) rescue ValidationError => e raise TypeError, <<~EOL #{e.message} Examples: - `[Project]`: means collection of Project - `Project`: means single resouce Project In your controller: endpoint [Project] def index # ... some code end EOL end
endpoint_hash()
click to toggle source
# File lib/open_api_annotator/controller_annotatable.rb, line 3 def endpoint_hash @endpoint_hash ||= {} end
method_added(name)
click to toggle source
Calls superclass method
# File lib/open_api_annotator/controller_annotatable.rb, line 33 def method_added(name) super return unless @last_endpoint endpoint = @last_endpoint @last_endpoint = nil return if private_method_defined?(name) endpoint_hash[name] = endpoint end
validate_open_api_type!(type)
click to toggle source
# File lib/open_api_annotator/controller_annotatable.rb, line 7 def validate_open_api_type!(type) @open_api_type_validator ||= TypeValidator.new @open_api_type_validator.validate!(type) end