ministryofjustice/Claim-for-Crown-Court-Defence

View on GitHub
app/controllers/json_template_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class JsonTemplateController < ApplicationController
  skip_load_and_authorize_resource only: %i[show]

  before_action :schema, only: :show

  def show
    render json: schema
  end

  private

  def schema
    @schema ||= ClaimJsonSchemaValidator.send(schema_params[:schema].to_sym)
  end

  def schema_params
    params.permit(:schema)
  end
end