lib/concourse-fuselage/support/validation.rb in concourse-fuselage-0.5.1 vs lib/concourse-fuselage/support/validation.rb in concourse-fuselage-0.5.2
- old
+ new
@@ -6,26 +6,26 @@
# Payload validation for Resource
module Validation
include ::Contracts::Core
include ::Contracts::Builtin
- Contract None => String
+ Contract String => String
def validated(payload)
return payload unless malformed? payload
STDERR.puts 'Resource failed to produce valid JSON', payload
abort
end
- Contract None => Bool
+ Contract String => Bool
def valid?(payload)
JSON.parse payload
true
rescue JSON::ParseError
false
end
- Contract None => Bool
+ Contract String => Bool
def malformed?(payload)
!valid? payload
end
end
end