-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
It seems that this plugin does not include the package generated sources for a schema including javaTypes.
If the following schema is given:
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "urn:OCPP:Cp:2:2018:4:BootNotificationRequest",
"comment": "OCPP 2.0 - v1p0",
"definitionnames": {
"BootReasonEnumType": {
"type": "string",
"additionalProperties": true,
"enum": [
"ApplicationReset",
"FirmwareUpdate",
"LocalReset",
"PowerUp",
"RemoteReset",
"ScheduledReset",
"Triggered",
"Unknown",
"Watchdog"
]
},
"ChargingStationType": {
"javaType": "ChargingStation",
"type": "object",
"additionalProperties": true,
"properties": {
"serialNumber": {
"type": "string",
"maxLength": 20
},
"model": {
"type": "string",
"maxLength": 20
},
"modem": {
"$ref": "#/definitions/ModemType"
},
"vendorName": {
"type": "string",
"maxLength": 50
},
"firmwareVersion": {
"type": "string",
"maxLength": 50
}
},
"required": [
"model",
"vendorName"
]
},
"ModemType": {
"javaType": "Modem",
"type": "object",
"additionalProperties": true,
"properties": {
"iccid": {
"type": "string",
"maxLength": 20
},
"imsi": {
"type": "string",
"maxLength": 20
}
}
}
},
"type": "object",
"additionalProperties": true,
"properties": {
"chargingStation": {
"$ref": "#/definitions/ChargingStationType"
},
"reason": {
"$ref": "#/definitions/BootReasonEnumType"
}
},
"required": [
"reason",
"chargingStation"
]
}
jsonschema2pojo generates these classes:
package org.openchargealliance.ocpp20;
... (the rest of the imports)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"chargingStation",
"reason"
})
public class BootNotificationRequest implements Serializable
{
/**
*
* (Required)
*
*/
@JsonProperty("chargingStation")
@NotNull
private ChargingStation chargingStation;
...
and
import java.io.Serializable;
... (the rest of the imports)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"serialNumber",
"model",
"modem",
"vendorName",
"firmwareVersion"
})
public class ChargingStation implements Serializable
{
In this case the ChargingStation.java class does not contain the package declaration.
There is a workaround to pass the packae name to the nested objects by changing the javaType to:
javaType: "${package.path.Class}" ( which is absolutly not recommended and dirty)
But still then the import statements for the nested classes are missing.
Metadata
Metadata
Assignees
Labels
No labels