Module: Ronin::App::Schemas::Payloads::Encoders
- Defined in:
- lib/ronin/app/schemas/payloads/encoders/encode_schema.rb
Overview
Contains class methods for building dry-schemas for the
/payloads/encoders
routes.
Class Method Summary collapse
-
.EncodeSchema(encoder_class) ⇒ Dry::Schema::Params
Builds a
Dry::Schema::Params
schema for the given payload encoder class and for thePOST /payloads/encoders/encode...
route.
Class Method Details
.EncodeSchema(encoder_class) ⇒ Dry::Schema::Params
Builds a Dry::Schema::Params
schema for the given payload encoder
class and for the POST /payloads/encoders/encode...
route.
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ronin/app/schemas/payloads/encoders/encode_schema.rb', line 44 def self.EncodeSchema(encoder_class) # dynamically encode the dry-schema based on the encoder's params params_schema = Schemas::ParamsSchema(encoder_class.params) return Dry::Schema::Params() do required(:data).filled(:string) unless encoder_class.params.empty? required(:params).hash(params_schema) end end end |