# Contributing guide
Thank you for your help making Ajv better! Every contribution is appreciated. There are many areas where you can contribute.
More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation.
At Ajv, we are committed to creating more equitable and inclusive spaces for our community and team members to contribute to discussions that affect both this project and our ongoing work in the open source ecosystem.
We strive to create an environment of respect and healthy discourse by setting standards for our interactions and we expect it from all members of our community - from long term project member to first time visitor. For more information, review our code of conduct and values.
Submit issue first
If you plan to implement a new feature or some other change please create an issue first, to make sure that your work is not lost.
# Documentation
Ajv has a lot of features and maintaining documentation takes time. If anything is unclear, or could be explained better, we appreciate the time you spend correcting or clarifying it.
There is a link in the bottom of each website page to quickly edit it.
# Issues
Before submitting the issue:
- Search the existing issues
- Review Frequently Asked Questions.
- Provide all the relevant information, reducing both your schema and data to the smallest possible size when they still have the issue.
We value simplicity - simplifying the example that shows the issue makes it more valuable for other users. This process helps us reduce situations where an error is occurring due to incorrect usage rather than a bug.
# Bug reports
Please make sure to include the following information in the issue:
- What version of Ajv are you using?
- Does the issue happen if you use the latest version?
- Ajv options object
- Schema and the data you are validating (please make it as small as possible to reproduce the issue).
- Your code sample (please use
options
,schema
anddata
as variables). - Validation result, data AFTER validation, error messages.
- What results did you expect?
To speed up investigation and fixes, please include the link to the working code sample at runkit.com (please clone https://runkit.com/esp/ajv-issue).
Create bug report (opens new window).
# Security vulnerabilities
To report a security vulnerability, please use the Tidelift security contact (opens new window). Tidelift will coordinate the fix and disclosure.
Please do NOT report security vulnerabilities via GitHub issues.
# Change proposals
Create a proposal (opens new window) for a new feature, option or some other improvement.
Please include this information:
- The version of Ajv you are using.
- The problem you want to solve.
- Your solution to the problem.
- Would you like to implement it?
If you’re requesting a change, it would be helpful to include this as well:
- What you did.
- What happened.
- What you would like to happen.
Please include as much details as possible - the more information, the better.
# Browser and compatibility issues
Create an issue (opens new window) to report a compatibility problem that only happens in a particular environment (when your code works correctly in the latest stable Node.js in linux systems but fails in some other environment).
Please include this information:
- The version of Ajv you are using.
- The environment you have the problem with.
- Your code (please make it as small as possible to reproduce the issue).
- If your issue is in the browser, please list the other packages loaded in the page in the order they are loaded. Please check if the issue gets resolved (or results change) if you move Ajv bundle closer to the top.
- Results in the latest stable Node.js.
- Results and error messages in your platform.
# Installation and dependency issues
Create an issue (opens new window) to report problems that happen during Ajv installation or when Ajv is missing some dependency.
Before submitting the issue, please try the following:
- use the latest stable Node.js and
npm
- try using
yarn
instead ofnpm
- the issue can be related to https://github.com/npm/npm/issues/19877 - remove
node_modules
andpackage-lock.json
and runnpm install
again
If nothing helps, please submit:
- The version of Ajv you are using
- Operating system and Node.js version
- Package manager and its version
- Link to (or contents of) package.json and package-lock.json
- Error messages
- The output of
npm ls
# Using JSON Schema standard
Ajv implements JSON Schema standard draft-04 and draft-06/07.
If it is a general issue related to using the standard keywords included in JSON Schema specification or implementing some advanced validation logic please ask the question on Stack Overflow (opens new window) (my account is esp (opens new window)) or submit the question to json-schema.org (opens new window). Please mention @epoberezkin.
# Ajv usage questions
The best place to ask a question about using Ajv is Gitter chat (opens new window).
If the question is advanced, it can be submitted to Stack Overflow (opens new window).
# Code
Thanks a lot for considering contributing to Ajv! Our users have created many great features, and we look forward to your contributions.
For help navigating the code, please review the Code components document.
# How we make decisions
We value conscious curation of our library size, and balancing performance and functionality. To that end, we cannot accept every suggestion. When evaluating pull requests we consider:
- Will this benefit many users or a niche use case?
- How will this impact the performance of Ajv?
- How will this expand our library size?
To help us evaluate and understand, when you submit an issue and pull request:
- Explain why this feature is important to the user base
- Include documentation
- Include test coverage with any new feature implementations
Please include documentation and test coverage with any new feature implementations.
# Development
Running tests:
npm install
git submodule update --init
npm test
npm run build
- compiles typescript to dist folder.
npm run watch
- automatically compiles typescript when files on lib folder changes.
# Pull requests
We want to iterate on the code efficiently. To speed up the process, please follow these steps:
- Submit an issue with the bug (opens new window) or with the proposed change (unless the contribution is to fix the documentation typos and mistakes).
- Describe the proposed api and implementation plan (unless the issue is a relatively simple bug and fixing it doesn't change any api).
- Once agreed, please write as little code as possible to achieve the desired result. We are passionate about keeping our library size optimized.
- Please add the tests both for the added feature and, if you are submitting an option, for the existing behaviour when this option is turned off or not passed.
- Please avoid unnecessary changes, refactoring or changing coding styles as part of your change (unless the change was proposed as refactoring).
- Follow the coding conventions even if they are not validated.
- Please run the tests before committing your code.
- If tests fail in CI build after you make a PR please investigate and fix the issue.
# Contributions license
When contributing the code you confirm that:
- Your contribution is created by you.
- You have the right to submit it under the MIT license.
- You understand and agree that your contribution is public, will be stored indefinitely, can be redistributed as the part of Ajv or another related package under MIT license, modified or completely removed from Ajv.
- You grant irrevocable MIT license to use your contribution as part of Ajv or any other package.
- You waive all rights to your contribution.
- Unless you request otherwise, you can be mentioned as the author of the contribution in the Ajv documentation and change log.