Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for geoJSON in metadata #25

Merged
merged 5 commits into from
Jan 26, 2025
Merged

Conversation

bitbeckers
Copy link
Contributor

  • Introduces validator classes for a more scalable implementation of the validation methods
  • Deprecated current validator methods
  • Adds support for validating metadata properties, including specific types like geoJSON
  • Updated test suites

Refactors the SDK validators to use classes instead of a single file
with repeating methods.

- Create base abstract SchemaValidator with AJV integration
- Implement specialized validators:
  - MetadataValidator with nested schema support
  - ClaimDataValidator for hypercert claims
  - AllowlistValidator for merkle tree entries
  - MerkleProofValidator for proof verification

- Add comprehensive test suite for all validators
- Maintain backwards compatibility through legacy API wrapper
- Improve error handling with structured ValidationError type
- Introduce ValidatorFactory for consistent instantiation
Add property validator that also specifically checks for geoJSONs. The
pattern should be scalable to multiple specific types of properties.

Updated the metadata validator to validate properties in metadata when
applicable.

Add and update test suite
Updates thresholds to represent current coverage
@bitbeckers bitbeckers added the enhancement New feature or request label Jan 26, 2025
@bitbeckers bitbeckers self-assigned this Jan 26, 2025
Copy link

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 72.44% (🎯 72%) 1028 / 1419
🟢 Statements 72.44% (🎯 72%) 1028 / 1419
🟢 Functions 66.95% (🎯 66%) 77 / 115
🟢 Branches 84.81% (🎯 84%) 229 / 270
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/validator/ValidatorFactory.ts 77.77% 100% 60% 77.77% 19-20, 27-28
src/validator/index.ts 82% 84.61% 83.33% 82% 83-89, 122-123
src/validator/interfaces.ts 100% 100% 100% 100%
src/validator/base/SchemaValidator.ts 100% 81.81% 100% 100%
src/validator/validators/AllowListValidator.ts 100% 100% 100% 100%
src/validator/validators/MerkleProofValidator.ts 100% 100% 100% 100%
src/validator/validators/MetadataValidator.ts 100% 90.9% 100% 100%
src/validator/validators/PropertyValidator.ts 88.23% 93.75% 100% 88.23% 25-32
Generated in workflow #17 for commit f205913 by the Vitest Coverage Report Action

@bitbeckers bitbeckers merged commit 7e16d00 into develop Jan 26, 2025
2 checks passed
@bitbeckers bitbeckers deleted the feat/geojson_support_metadata branch January 26, 2025 21:50
@bitbeckers bitbeckers linked an issue Jan 26, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Updates validator schemas to support geoJSON in the properties
1 participant