Skip to content

struct Athena::Framework::Controller::ValueResolvers::UUID
inherits Struct #

Handles resolving a UUID from a string value that is stored in the request's ATH::Request#attributes.

require "athena"

class ExampleController < ATH::Controller
  @[ARTA::Get("/uuid/{uuid}")]
  def get_uuid(uuid : UUID) : String
    "Version: #{uuid.version} - Variant: #{uuid.variant}"
  end
end

ATH.run

# GET /uuid/b115c7a5-0a13-47b4-b4ac-55b3e2686946 # => "Version: V4 - Variant: RFC4122"

Tip

Checkout ART::Requirement for an easy way to restrict/validate the version of the UUID that is allowed.

Included modules

Athena::Framework::Controller::ValueResolvers::Interface

Constructors#

Methods#

#initialize#

View source

#resolve(request : ATH::Request, parameter : ATH::Controller::ParameterMetadata) : ::UUID | Nil#

Returns a value resolved from the provided request and parameter if possible, otherwise returns nil if no parameter could be resolved.

View source