Custom JSON/YAML providers
Adding custom providers seems simple, but there are a lot of edge cases that need to be considered. It is recommended to base your implementation on the officially provided providers (like this one).
Running the test suite
Start by cloning the repository:
git clone https://github.com/harrel56/json-schema.git
Create a new directory for your provider test:
mkdir json-schema/src/integration/customJson
Create actual test implementation:
// json-schema/src/integration/customJson/CustomJsonTest.java
import dev.harrel.jsonschema.JsonNodeFactory;
import dev.harrel.jsonschema.ProviderTestBundle;
class CustomJsonTest extends ProviderTestBundle {
@Override
public JsonNodeFactory getJsonNodeFactory() {
return new CustomJsonNode.Factory();
}
}
Add the actual JSON library dependency to build.gradle
to jsonProviders
array (note that id
must match the created directory name):
def jsonProviders = [
[id : 'customJson', additionalVersions: [],
group: 'com.custom.json', name: 'json-library', version: '1.0.0'],
// ... other entries omitted for brevity
]
Run the tests:
cd json-schema \
./gradlew customJsonTest
04 August 2025