Skip to content

Commit

Permalink
fix uri in validation message
Browse files Browse the repository at this point in the history
  • Loading branch information
razum2um committed Dec 12, 2015
1 parent aac7c91 commit 4cd9b64
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion lib/lurker.rb
Expand Up @@ -60,7 +60,6 @@ class UndocumentedResponseCode < ValidationError; end
require 'lurker/erb_schema_context'
require 'lurker/service'
require 'lurker/validator'
require 'lurker/validation_error'
require 'lurker/utils'
require 'lurker/endpoint'
require 'lurker/rendering_controller'
Expand Down
8 changes: 4 additions & 4 deletions lib/lurker/endpoint.rb
Expand Up @@ -192,15 +192,15 @@ def raise_errors!
def word_wrap(text)
# strip .json# | .json.yml# | .json.yml.erb#
text = text.reverse
text.gsub!(/(\n|^)#bre\./, "\nbre.")
text.gsub!(/(\n|^)#lmy\./, "\nlmy.")
text.gsub!(/(\n|^)#nosj\./, "\nnosj.")
text.gsub!(/(\n|^)#bre\./, "\nbre.") # erb
text.gsub!(/(\n|^)#lmy\./, "\nlmy.") # yml
text.gsub!(/(\n|^)#nosj\./, "\nnosj.") # json
text.strip!
text = text.reverse

text.gsub!(/\s+in schema/m, "\n in schema")
if defined?(Rails)
text.gsub!(/file:\/\/#{Rails.root}\//m, "")
text.gsub!(/#{Rails.root}\//, "")
end
text
end
Expand Down
6 changes: 5 additions & 1 deletion lib/lurker/json/concerns/validatable.rb
Expand Up @@ -9,7 +9,11 @@ def validate(data)

def to_validation_schema
set_additional_properties_false_on(to_hash).tap do |schema|
schema[Json::ID] = "file://#{uri}"
schema[Json::ID] = if uri.class == URI::Generic
uri.path
else
uri.to_s
end
end
end

Expand Down
4 changes: 0 additions & 4 deletions lib/lurker/validation_error.rb

This file was deleted.

0 comments on commit 4cd9b64

Please sign in to comment.