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 schemas from classpath to facilitate schema sharing #7

Open
ngeor opened this Issue Nov 28, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@ngeor
Copy link

ngeor commented Nov 28, 2018

This is a new feature request.

Currently, the plugin supports loading schemas from the local filesystem. When using the same schema in multiple projects, it is useful to pack the schema in its own JAR and have the versioned JAR shared among the projects as a dependency.

In that case, it would be great to use the json-schema-validator plugin with a reference to the schema inside the JAR. This is a technique projects like checkstyle are using to share the configuration among projects.

It might look something like this:

      <plugin>
        <groupId>com.groupon.maven.plugin.json</groupId>
        <artifactId>json-schema-validator</artifactId>
        <version>1.2.0</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>validate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <validations>
            <validation>
              <directory>src/main/json</directory>
              <jsonSchema>classpath:my-custom-schemas.jar!amazing.schema</jsonSchema>
              <includes>
                <include>*.json</include>
              </includes>
            </validation>
          </validations>
        </configuration>
      </plugin>

As a (clunky) workaround, I can for now unzip my shared JAR manually before I invoke the json-schema-validator plugin, as mentioned here.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment