joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc

Home Page:http://www.jsonschema2pojo.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsonschema2pojo not generating classes

kjellmoens opened this issue · comments

I am trying to generate pojo from a json schema but the classes are not generated.

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "changeRealizationDate": {
      "type": "string",
      "format": "date-time"
    },
    "destinationEmployerId": {
      "$ref": "#/definitions/EmployerId"
    },
    "modificationType": {
      "type": "string",
      "pattern": "^\\d{2}$"
    },
    "originalEmployerId": {
      "$ref": "#/definitions/EmployerId"
    }
  },
  "required": [
    "changeRealizationDate",
    "destinationEmployerId",
    "modificationType",
    "originalEmployerId"
  ],
  "definitions": {
    "EmployerId": {
      "description": "Definitive or provisional NSSO number, assigned to each registered employer or local or provincial administration.",
      "type": "integer",
      "format": "int64",
      "minimum": 197,
      "maximum": 5999999999
    }
  }
}

Contents of the pom.xml

            <plugin>
                <groupId>org.jsonschema2pojo</groupId>
                <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
                    <outputDirectory>${basedir}/directory/src/main/java</outputDirectory>
                    <includeJsr303Annotations>true</includeJsr303Annotations>
                    <dateType>java.time.LocalDate</dateType>
                    <dateTimeType>java.time.LocalDateTime</dateTimeType>
                    <generateBuilders>true</generateBuilders>
                    <targetPackage>be.smals.nnsoregistrationnumber_transfer_event_generator.dto</targetPackage>
                    <includeAdditionalProperties>false</includeAdditionalProperties>
                    <targetVersion>1.8</targetVersion>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

When I run maven with the -X option, I get the following output but no files are generated

[DEBUG] Reading schema: file:/C:/Users/kjm/Source/dimona-transfer-event-generator/src/main/resources/schema/payload.schema.json
[DEBUG] Adding be.smals.nnsoregistrationnumber_transfer_event_generator.dto.PayloadSchema
commented

Hi

Schema looks correct, I have tried it out and output was generated as expected.
Did you check correct folder for output: C:/Users/kjm/Source/dimona-transfer-event-generator/directory/src/main/java ?

The only thing I would change is removing:
<outputDirectory>${basedir}/directory/src/main/java</outputDirectory>
Such that output would be generated under: /target/generated-sources/jsonschema2pojo/be/smals/nnsoregistrationnumber_transfer_event_generator and automatically picked up by IDE