-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
formatDateTimes in gradle is private and thus cannot be set to 'true' #1642
Comments
Hi Can you provide an example ? Could not reproduce with following input:
{
"type": "object",
"properties": {
"defaultFormat" : {
"type" : "string",
"format" : "date-time"
}
}
}
jsonSchema2Pojo {
setSource(files("$projectDir/src/main/resources/json"))
formatDateTimes = true
} generates class: ...
@Generated("jsonschema2pojo")
public class Test {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "UTC")
@JsonProperty("defaultFormat")
private Date defaultFormat;
... whereas with @Generated("jsonschema2pojo")
public class Test {
@JsonProperty("defaultFormat")
private Date defaultFormat; |
Hi! Unfortunatelly I am unable to provide a screenshot due to some restrictions on my work pc, the configuration looks like this and I get this error only for the formatDateTimes property. If I remove it I get no errors. I also tried to stop all gradle daemons, clean gradle caches, invalidate idea's caches. The error message is: And I cannot provide the json schema because it contains sensitive info. But it works fine with maven. plugins {
...
id("org.jsonschema2pojo") version "1.2.2"
}
jsonSchema2Pojo {
sourceFiles = files("/example")
targetPackage = "org.example"
includeHashcodeAndEquals = false
includeToString = false
includeAdditionalProperties = false
formatDateTimes = true <--- here I get an error
formatDates = true
dateType = "java.time.LocalDate"
dateTimeType = "java.time.OffsetDateTime"
useLongIntegers = true
useDoubleNumbers = false
} |
Some questions:
|
It seems that gradle kotlin dsl behaves differently than groovy dsl. setFormatDateTimes(true) instead of formatDateTimes = true |
I am using kotlin dsl, the gradle version is 7.4 |
thanks for the option with the setter, but I have already tried it and it cannot resolve the setter also, as the property is "private" :( |
That's weird - checked with following combinations and it worked fine jsonSchema2Pojo {
sourceFiles = files("/src/main/resources/schema")
targetPackage = "my.pkg"
generateBuilders = false
setFormatDateTimes(true)
} jsonSchema2Pojo {
sourceFiles = files("/src/main/resources/schema")
targetPackage = "my.pkg"
generateBuilders = false
isFormatDateTimes = true
} Would be good to get a SSCCE (all company/work code could be stripped/replaced/reduced to bare minimum) |
We are currently migrating our project from maven to gradle and noticed that the "formatDateTimes" property cannot be set in the gradle because it is private. We are using the latest 1.2.2 version. The property is in the README.md and is described as changeable.
The text was updated successfully, but these errors were encountered: