Skip to content
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

javaInterfaces extension property is ignored for Enum types #172

Closed
Ghorric opened this issue Apr 17, 2014 · 2 comments
Closed

javaInterfaces extension property is ignored for Enum types #172

Ghorric opened this issue Apr 17, 2014 · 2 comments
Milestone

Comments

@Ghorric
Copy link

Ghorric commented Apr 17, 2014

It is not possible to add an Interface to an Enum:

{
    "type" : "string",
    "javaInterfaces" : ["MyInterface"],
    "enum" : ["FOO", "BAR"] 
}

org.jsonschema2pojo.rules.ObjectRule has the 'addInterfaces' method that is missing in org.jsonschema2pojo.rules.EnumRule:

    private void addInterfaces(JDefinedClass jclass, JsonNode javaInterfaces) {
        for (JsonNode i : javaInterfaces) {
            jclass._implements(jclass.owner().ref(i.asText()));
        }
    }
@joelittlejohn joelittlejohn changed the title Java Interfaces for Enum javaInterfaces extension property is ignored for Enum types Apr 17, 2014
@joelittlejohn
Copy link
Owner

@Ghorric We can definitely fix this. Do you actually have a need to support this or is this simply something you have found whilst experimenting?

@Ghorric
Copy link
Author

Ghorric commented Apr 17, 2014

This is actually something that I need. There is no workaround for this problem because you can't extend an Enum :(. A fix for this issue would be much appreciated.

@joelittlejohn joelittlejohn added this to the 0.4.2 milestone Apr 17, 2014
Ghorric pushed a commit to Ghorric/jsonschema2pojo that referenced this issue Apr 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants