Open ben-manes opened 7 years ago
@ben-manes do you have a simple schema that produces the problem?
Unfortunately I don't. This ran on a few dozen schemas, which have dependencies on each other. Taking it a few random ones and running it on the web tool doesn't fail. So I'm not sure how to provide a meaningful error.
Okay, no problem. It may be possible to simply understand this one using the code and your stack trace. @ctrimble might have some ideas here.
Thanks @ben-manes for report this. I will see if I can put together a test case to reproduce it.
I am having a hard time creating a test that makes this fail. @ben-manes to you have any other configuration options set?
Sorry that I can't be more descriptive. There's nothing confidential about the schemas, so I can probably wrap them into a project for you and email it across.
jsonSchema2Pojo {
removeOldOutput = false
useCommonsLang3 = true
generateBuilders = true
includeConstructors = true
includeJsr303Annotations = true
propertyWordDelimiters = ['_'] as char[]
targetPackage = '....'
source = files("${sourceSets.main.output.resourcesDir}/json")
}
The schemas would be very helpful.
Sent to your gmail. Thanks!
So, dumped all of your schemas into an integration test, with your configuration, and I can get the generated output to compile. Could this be due to removeOldOutput = false
?
Changing that flag doesn't fix it locally. You ran it using the gradle build file? That should be reproducible unless there's a surprising environmental problem.
I dumped it into an IT test in maven to start. I will see what Gradle is producing.
I can recreate it, so this should be enough info.
I just ran into this again and was about to report it anew. :)
I also noticed that the feature doesn't take effect unless I enable includeDynamicAccessors
and either includeDynamicGetters
or includeDynamicSetters
. The description isn't clear that this has to be enabled as a gate before a subsetting is evaluated, which might be more clearly worded.
@ben-manes I am sorry this issue was never resolved. I will see if I can dig up any work I did and throw together a PR with the schemas and test procedures to recreate the issue.
Oh it’s not a big deal. I will happily map by hand and that’s probably better, since I rarely need this. Just amused since I completely forgot I hit it before.
On Wed, Jun 12, 2019 at 12:02 AM Christian Trimble notifications@github.com wrote:
@ben-manes https://github.com/ben-manes I am sorry this issue was never resolved. I will see if I can dig up any work I did and throw together a PR with the schemas and test procedures to recreate the issue.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joelittlejohn/jsonschema2pojo/issues/666?email_source=notifications&email_token=AAC4N5TVCU2K7BL2TJU4QALP2CNOTA5CNFSM4CZ7JF5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXPOLGQ#issuecomment-501147034, or mute the thread https://github.com/notifications/unsubscribe-auth/AAC4N5XWCPARVUS5GJ7FAHTP2CNOTANCNFSM4CZ7JF5A .
It looks like I don't have the tests mentioned in this issue.
Resent the original attachment, which was a failing Gradle build. I hope that helps, but you can also ignore this again as it is not blocking me.
@ctrimble @joelittlejohn I am also seeing the same error, able to reproduce it with this schema. I am using the maven plugin to generate the POJOs
Schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"definitions": {
"myObj": {
"type": "object",
"properties": {
"foo": {
"type": "string"
},
"bar": {
"type": "integer"
},
"baz": {
"type": "boolean"
}
}
}
},
"properties": {
"test": {
"$ref": "#/definitions/myObj"
}
}
}
Maven Plugin:
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>1.0.2</version>
<executions>
<execution>
<configuration>
<annotationStyle>jackson2</annotationStyle>
<generateBuilders>true</generateBuilders>
<includeAdditionalProperties>true</includeAdditionalProperties>
<includeConstructors>false</includeConstructors>
<includeDynamicAccessors>true</includeDynamicAccessors>
<includeDynamicGetters>true</includeDynamicGetters>
<includeGetters>true</includeGetters>
<includeHashcodeAndEquals>true</includeHashcodeAndEquals>
<includeJsr303Annotations>true</includeJsr303Annotations>
<includeJsr305Annotations>true</includeJsr305Annotations>
<includeSetters>false</includeSetters>
<includeToString>true</includeToString>
<inclusionLevel>NON_NULL</inclusionLevel>
<initializeCollections>false</initializeCollections>
<useInnerClassBuilders>true</useInnerClassBuilders>
</configuration>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
</plugin>
I was curious to see what the
includeDynamicAccessors
flag outputted. When I added it the task failed with,