reinert / JJSchema

A generator from Java Types to JSON-Schema using Jackson.
Other
117 stars 56 forks source link

ClassCastException when using types that extends Collection<Something> #73

Closed lordvlad closed 6 years ago

lordvlad commented 6 years ago

I've got a class like this:

public class People extends ArrayList< Person > {
...
}

And I'm using it, for example, in a class like

public class Company {
    People employees;
}

When I'm trying to generate a json schema for Company, I run in a CLassCastException at PropertyWrapper.java:79

java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
    at com.github.reinert.jjschema.v1.PropertyWrapper.<init>(PropertyWrapper.java:79)
    at com.github.reinert.jjschema.v1.CustomSchemaWrapper.processProperties(CustomSchemaWrapper.java:154)
    at com.github.reinert.jjschema.v1.CustomSchemaWrapper.<init>(CustomSchemaWrapper.java:87)
    at com.github.reinert.jjschema.v1.CustomSchemaWrapper.<init>(CustomSchemaWrapper.java:63)
    at com.github.reinert.jjschema.v1.SchemaWrapperFactory.createWrapper(SchemaWrapperFactory.java:71)
    at com.github.reinert.jjschema.v1.SchemaWrapperFactory.createWrapper(SchemaWrapperFactory.java:47)
    at com.github.reinert.jjschema.v1.SchemaWrapperFactory.createWrapper(SchemaWrapperFactory.java:39)
    at com.github.reinert.jjschema.v1.JsonSchemaV4Factory.createSchema(JsonSchemaV4Factory.java:36)