Thank you for your interest in contributing to jsonpathly! This document provides guidelines and instructions for contributing.
-
Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/jsonpathly.git cd jsonpathly -
Install dependencies
npm install
-
Run tests
npm test -
Build the project
npm run build
src/
├── index.ts # Public API exports
├── handler/
│ ├── Handler.ts # Core query engine
│ ├── query.ts # query() function
│ ├── paths.ts # paths() function
│ ├── comparators.ts # Filter comparators (==, <, in, etc.)
│ ├── functions.ts # RFC 9535 functions (length, match, etc.)
│ └── helper.ts # Type guards and utilities
└── parser/
├── jsonpath.peggy # Peggy grammar (source of truth)
├── parse.ts # parse() function
├── stringify.ts # stringify() function
├── types.ts # AST type definitions
├── errors.ts # JSONPathSyntaxError
└── generated/ # Auto-generated parser (do not edit)
-
Create a feature branch from
mastergit checkout -b feature/your-feature-name
-
Make your changes
-
If you modified the grammar (
jsonpath.peggy), regenerate the parser:npm run gen
-
Run tests and linting:
npm test npm run lint -
Commit your changes with a descriptive message
We follow conventional commit style:
feat:New featurefix:Bug fixdocs:Documentation onlyrefactor:Code change that neither fixes a bug nor adds a featuretest:Adding or updating testschore:Maintenance tasks
Examples:
feat: add support for custom functions
fix: handle empty arrays in slice expressions
docs: update API documentation
- Push your branch to your fork
- Open a PR against
master - Fill in the PR template
- Wait for CI checks to pass
- Address any review feedback
# Run all tests
npm test
# Run specific test file
npx mocha --require ts-node/register tests/query.test.ts
# Run with coverage
npx c8 npm test- Add tests for any new functionality
- Place tests in the appropriate file in
tests/ - Follow existing test patterns and naming conventions
- Ensure edge cases are covered
- We use Prettier for formatting
- We use ESLint for linting
- Run
npm run formatbefore committing
jsonpathly aims to be RFC 9535 compliant. When making changes:
- Reference the RFC for expected behavior
- Add tests that verify RFC compliance
- Document any intentional deviations
- Use GitHub Issues for bug reports and feature requests
- Include a minimal reproduction case for bugs
- Check existing issues before creating new ones
Feel free to open a GitHub Discussion or Issue if you have questions about contributing.