This project is a jsonschema2pojo extension dedicated to interface generation.
This extension generate interfaces. It acts like a post-processing tool removing all field and method bodies.
E.g., this schema:
{
"title": "Sample entity",
"type": "object",
"properties": {
"field": {
"title": "A field",
"type": "string"
}
}
}
Will produce:
public interface Entity {
String getField();
void setField(String field);
}
Here is an example of how the extension can be added to the jsonschema2pojo Maven plugin.
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>${jsonschema2pojo-interfaces.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
...
<!-- Extension RuleFactory -->
<customRuleFactory>
dev.hctbst.jsonschema2pojo.interfaces.InterfacesRuleFactory
</customRuleFactory>
</configuration>
</execution>
</executions>
<dependencies>
<!-- Extension dependency -->
<dependency>
<groupId>dev.hctbst</groupId>
<artifactId>jsonschema2pojo-interfaces</artifactId>
<version>${jsonschema2pojo-interfaces.version}</version>
</dependency>
</plugin>
A more complete example is available here.
This project is released under version 2.0 of the Apache License.