OpenAPITools/openapi-generator · error · RuntimeException

{} is an invalid enum property naming option. Please choose

Error message

{} is an invalid enum property naming option. Please choose from:

What it means

XojoClientCodegen.setSerializationLibrary (line 708) parses the 'serializationLibrary' option with enum valueOf against SERIALIZATION_LIBRARY_TYPE, which contains exactly one constant: 'xoson' (line 52). Any other string throws a RuntimeException listing the valid values. Note the message text ('invalid enum property naming option') is a copy-paste artifact — it really refers to the serialization library, and the parse is case-sensitive, so 'XOSON' also fails.

Source

Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/XojoClientCodegen.java:708

            codegenParameter.example = "New Dictionary";
        }
    }

    /**
     * Sets the serialization engine for Xojo
     *
     * @param enumSerializationLibrary The string representation of the serialization library as defined by
     *                                 {@link org.openapitools.codegen.languages.XojoClientCodegen.SERIALIZATION_LIBRARY_TYPE}
     */
    public void setSerializationLibrary(final String enumSerializationLibrary) {
        try {
            this.serializationLibrary = SERIALIZATION_LIBRARY_TYPE.valueOf(enumSerializationLibrary);
        } catch (IllegalArgumentException ex) {
            StringBuilder sb = new StringBuilder(enumSerializationLibrary + " is an invalid enum property naming option. Please choose from:");
            for (SERIALIZATION_LIBRARY_TYPE t : SERIALIZATION_LIBRARY_TYPE.values()) {
                sb.append("\n  ").append(t.name());
            }
            throw new RuntimeException(sb.toString());
        }
    }

    private String getDefaultPropertyValue(Schema schema) {
        if (ModelUtils.isBooleanSchema(schema)) {
            return "False";
        } else if (ModelUtils.isDateSchema(schema)) {
            return "Nil";
        } else if (ModelUtils.isDateTimeSchema(schema)) {
            return "Nil";
        } else if (ModelUtils.isNumberSchema(schema)) {
            return "0";
        } else if (ModelUtils.isIntegerSchema(schema)) {
            return "0";
        } else if (ModelUtils.isStringSchema(schema)) {
            return "Sample";
        } else if (ModelUtils.isObjectSchema(schema)) {
            return "Nil";

View on GitHub (pinned to fcec517be3)

Solutions

  1. Drop the serializationLibrary option for Xojo — 'xoson' is the default and only choice.
  2. Or pass the exact lowercase value: -DserializationLibrary=xoson (valueOf is case-sensitive).
  3. Read the appended list in the thrown message; it enumerates every accepted constant.

Example fix

# before
openapi-generator-cli generate -g xojo-client \
  -DserializationLibrary=XML

# after
openapi-generator-cli generate -g xojo-client
# (xoson is the default; or pass -DserializationLibrary=xoson)
Defensive patterns

Strategy: validation

Validate before calling

if [ -n "$SERIALIZATION_LIBRARY" ] && [ "$SERIALIZATION_LIBRARY" != "xoson" ]; then
  echo "ERROR: xojo only supports serializationLibrary=xoson (case-sensitive)" >&2
  exit 1
fi

Type guard

const XOJO_SERIALIZATION_LIBRARIES = ['xoson'] as const;
type XojoSerializationLibrary = typeof XOJO_SERIALIZATION_LIBRARIES[number];
const isXojoSerializationLibrary = (v: string): v is XojoSerializationLibrary =>
  (XOJO_SERIALIZATION_LIBRARIES as readonly string[]).includes(v);

Prevention

When it happens

Trigger: Passing -DserializationLibrary=json, -DserializationLibrary=XML (copied from the java generator), or even -DserializationLibrary=XOSON with wrong casing. Xojo currently only supports its native Xoson DTO serialization.

Common situations: Shared generation scripts that set serializationLibrary for many target languages; upgrading from generators where this option is meaningful; users who don't realize xoson is the only and default value.

Related errors


AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22). Data as JSON: /api/errors/5289f6ebc359ac00. Report an issue: GitHub.