mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Merge branch 'experimental-live-schema-support'
This commit is contained in:
commit
48af3e77cd
65 changed files with 1346 additions and 1205 deletions
|
@ -6,6 +6,20 @@ class EppController < ApplicationController
|
|||
|
||||
before_action :generate_svtrid
|
||||
before_action :latin_only
|
||||
|
||||
before_action :validate_against_schema
|
||||
def validate_against_schema
|
||||
return if ['hello', 'error', 'keyrelay'].include?(params[:action])
|
||||
schema.validate(params[:nokogiri_frame]).each do |error|
|
||||
epp_errors << {
|
||||
code: 2001,
|
||||
msg: error
|
||||
}
|
||||
end
|
||||
|
||||
handle_errors and return if epp_errors.any?
|
||||
end
|
||||
|
||||
before_action :validate_request
|
||||
before_action :update_epp_session
|
||||
|
||||
|
@ -58,6 +72,13 @@ class EppController < ApplicationController
|
|||
render_epp_response '/epp/error'
|
||||
end
|
||||
|
||||
def schema
|
||||
# TODO: Support multiple schemas
|
||||
return DOMAIN_SCHEMA if params[:epp_object_type] == :domain
|
||||
return CONTACT_SCHEMA if params[:epp_object_type] == :contact
|
||||
EPP_SCHEMA
|
||||
end
|
||||
|
||||
def generate_svtrid
|
||||
# rubocop: disable Style/VariableName
|
||||
@svTRID = "ccReg-#{format('%010d', rand(10**10))}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue