Skip to content

struct Athena::Framework::Arguments::Resolvers::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.

Todo

Update this to use UUID.parse? in Crystal 1.5.0.

Included modules

Athena::Framework::Arguments::Resolvers::Interface

Constructors#

Methods#

#initialize#

View source

#resolve(request : ATH::Request, argument : ATH::Arguments::ArgumentMetadata)#

Returns a value resolved from the provided request and argument.

View source

#supports?(request : ATH::Request, argument : ATH::Arguments::ArgumentMetadata) : Bool#

Returns true if self is able to resolve a value from the provided request and argument.

View source