Hi,
I developed a sinatra API and tried to use json-schema validator creating a json file for each resource (customers, articles), but i have some questions.
1) It is possible to avoid some properties in validation process?
for example in a POST request i don't need a some properties, but yes in a PUT request i think it's no good idea have different schemas for each type of request.
2) When i do a JSON::Validator.fully_validate(schema_path, data) the errors message have the file path of the schema, i delete that part doing a gsub because i return the error message. Is there a more appropriate way to do this?
3) How i can return proporly a blank schema?
Not sure if this is okay:
get '/v1/costumers/schema.json' do
begin
status 200
body(File.open('costumers.json'))
rescue => e
status 400
body({:error => e.message}.to_json)
end
Thanks