thoughtbot / json_matchers

Validate your JSON APIs
MIT License
384 stars 40 forks source link

Does json_matchers adhere to the JSON schema spec #19

Open anthonator opened 8 years ago

anthonator commented 8 years ago

I recently asked this question on Stackoverflow.

Based on the discussion it was suggested that the parser I was using doesn't seem to be adhering to the spec. I tried an online schema validator and that seemed to be the case.

I was just curious if I'm doing something wrong to make this work with json_matchers or whether this gem doesn't work with this use case.

anthonator commented 8 years ago

Maybe this is relevant:

https://github.com/ruby-json-schema/json-schema#controlling-remote-schema-reading

seanpdoyle commented 8 years ago

@anthonator thanks for filing this issue.

That stack overflow question seems to have all the JSON required to reproduce this issue. Could you share your ruby code?

anthonator commented 8 years ago
describe "POST /users" do
  context 'with valid data' do
    let(:valid_data) { FactoryGirl.attributes_for(:user, :with_password) }

    before { post users_path, valid_data, headers }

    it { expect(response).to match_response_schema('user_schema') }
  end
end
philsturgeon commented 6 years ago

Since the guts of this gem have switched from json-schema to json_schema this question is probably moot? The validator is doing the work for validation, so if it was an issue it probably isn't anymore.