-
-
Notifications
You must be signed in to change notification settings - Fork 153
Add schema validation to Maven #1380
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
base: main
Are you sure you want to change the base?
Conversation
Add simplified WKT geometry check to schema. Schema validation limitations: - The plugin does not support validation of schema violations. See dataliquid/json-yaml-validator-maven-plugin#51 - The plugin does not support YAML aliases. See dataliquid/json-yaml-validator-maven-plugin#52
|
Full logs: https://github.com/onthegomap/planetiler/actions/runs/18958143687 |
|
Instead of doing this through maven what if we add a json schema validator as a dependency. Then we could have the unit tests that validate these files also check they match the json schema. It would also let us add a |
|
I have no strong feelings about this approach. Having a |
|
Hi @zstadler, Great news! We've just released https://github.com/dataliquid/json-yaml-validator-maven-plugin/releases/tag/1.1.0 of the json-yaml-validator-maven-plugin which addresses both issues you reported:
Thank you for reporting these issues - they've made the plugin much more robust! About Our JSON Validation ApproachWhen we researched JSON validators a few months ago, we found that while many validators exist, only the networknt/json-schema-validator truly adheres correctly to the JSON Schema specification. Many other validators we tested had issues with spec compliance, particularly with complex features like conditionals, $ref resolution, and proper error reporting. That's why we built this Maven plugin around networknt/json-schema-validator. Our experience has shown it handles even complex JSON validations excellently, including:
Example with v1.1.0's New Features<plugin>
<groupId>com.dataliquid.maven</groupId>
<artifactId>json-yaml-validator-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<!-- Validate that invalid configs are properly rejected -->
<execution>
<id>validate-invalid-configs</id>
<goals><goal>validate</goal></goals>
<configuration>
<schemaFile>src/main/resources/planetiler.schema.json</schemaFile>
<sourceDirectory>src/test/resources/invalid-configs</sourceDirectory>
<expectedResult>ERROR</expectedResult>
<expectedErrors>
<expectedError>.*storage.*required.*</expectedError>
<expectedError>.*threads.*minimum.*</expectedError>
</expectedErrors>
</configuration>
</execution>
</executions>
</plugin>I see @msbarry suggested an alternative approach with direct dependency integration. Both approaches could actually complement each other well - our plugin for build-time validation and the direct dependency for runtime validation and CLI commands. Feel free to try v1.1.0 if you'd like to continue with the Maven plugin approach. We're happy to help if you encounter any issues! |



Also, add simplified WKT geometry pattern to schema.
Schema validation limitations: