0

Currently, my swagger definition has :

"MyAttribute": { "type": "string", "default": "item1", "enum": [ "item1", "item2" ], "xml": { "attribute": true } },

Swagger codegen generates this java code:

@XmlEnum(String.class) public enum MyAttribute{

@XmlEnumValue("item1")
item1("item1"),

@XmlEnumValue("item2")
item2("item2");

private String value;

/**
 * @param value the string representation of the map specification type attribute
 */
MyAttribute(final String value) {
    this.value = value;
}

@Override
public String toString() {

    return String.valueOf(value);
}    

}

Now, I want to have a string array(with values) instead of enum. I tried this (but shows errors on swagger website : http://editor.swagger.io/)

"MyAttribute": { "type": "array", "items": { "type": "string", "values": [ "item1", "item2" ] }, "xml": { "attribute": true } }

How to achieve this?

4

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.