halidator
halidator copied to clipboard
Getting "_links does not exist" when no _links are returned
According to the hal spec, _links are optional
Please let me know if this is expected behavior. If so, I'm afraid I can't use this gem.
True it's not part of the spec but IMHO you just have regular json and don't need HAL specific validation if there's no _links attribute.
From the readme https://github.com/deathbob/halidator
The default validator is a pure ruby implementation that is slightly more strict than the spec http://tools.ietf.org/html/draft-kelly-json-hal-03. (Specifically, the default validator requires you to have a self link ...
You can try the json-schema validator built in, that might pass where the default hal validator fails
puts "Valid = #{Halidator.new(string, :json_schema).valid?}"
puts "Valid = #{Halidator.new(json, :json_schema).valid?}"