jsonschema2pojo icon indicating copy to clipboard operation
jsonschema2pojo copied to clipboard

Adding `javaType` to an enum causes `ClassAlreadyExistsException` on repeated generation

Open LitschiW opened this issue 5 months ago • 2 comments

I have the following (and only) schema in a folder `schemas/cloudfoundry/:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "javaType": "types.cloudfoundry.SecurityLane",
  "description": "The security lane of the space.",
  "enum": [
    "public",
    "medium",
    "secure",
    "intra"
  ]
}

with the following maven plugin setup:

<version>1.2.1</version>
<configuration>
    <sourceDirectory>${basedir}/schemas</sourceDirectory>
    <targetPackage>types</targetPackage>
    <removeOldOutput>true</removeOldOutput>
</configuration>

When running mvn clean compile test the old output is removed accordingly. But enum will not be generated again whilst still throwing a ClassAlreadyExistsException. This makes the Project uncompilable. Removing the javaType fixes this issue.

LitschiW avatar Sep 05 '24 09:09 LitschiW