Skip to content

feat(http): #14 add assert_json_schema for JSON Schema contract testing#15

Merged
othercodes merged 1 commit intomasterfrom
feature/14-assert-json-schema
Apr 13, 2026
Merged

feat(http): #14 add assert_json_schema for JSON Schema contract testing#15
othercodes merged 1 commit intomasterfrom
feature/14-assert-json-schema

Conversation

@othercodes
Copy link
Copy Markdown
Owner

Summary

  • Add AssertableJson.matches_schema() for JSON Schema validation against parsed JSON data
  • Add JsonContentAssertionsMixin.assert_json_schema() as a thin response-level wrapper
  • Support inline dicts, local file paths (str/Path), and remote URLs as schema sources
  • Add jsonschema>=4.0 as a hard dependency
  • Update README with examples covering all schema source types and scoped usage

Closes #14

Test plan

  • Inline dict schema: pass and fail cases
  • Local file path: str and Path variants, file not found error
  • Remote URL: mocked urllib.request.urlopen for pass and fail cases
  • Scoped context: error message includes scope path
  • Chaining: assert_json_schema returns Self, chains with other assertions
  • Integration: end-to-end via FluentHttpAssertClient against Django test views
  • 100% branch coverage maintained
  • Lint and format clean (ruff check + ruff format)

Add JSON Schema validation via jsonschema library. Supports inline
dicts, local file paths (str/Path), and remote URLs as schema sources.

- Add AssertableJson.matches_schema() as the core implementation
- Add JsonContentAssertionsMixin.assert_json_schema() as thin wrapper
- Add _resolve_schema() helper for polymorphic schema resolution
- Add jsonschema>=4.0 as a hard dependency
- Update README with examples and documentation
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 13, 2026

@othercodes othercodes self-assigned this Apr 13, 2026
@othercodes othercodes merged commit 73d4f25 into master Apr 13, 2026
16 checks passed
@othercodes othercodes deleted the feature/14-assert-json-schema branch April 13, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add assert_json_schema for JSON Schema contract testing

1 participant