OpenAPITools/openapi-generator · error · RuntimeException

Error! Codegen Parameter not yet supported in getPydanticTyp

Error message

Error! Codegen Parameter not yet supported in getPydanticType: {cp}

What it means

In AbstractPythonPydanticV1Codegen's getPydanticType for parameters, a parameter must end up with either a dataType (typed parameter) or content (request-body style). A parameter with neither falls through to this RuntimeException — the generator cannot map the parameter to any pydantic type.

Source

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

            typingImports.add("Any");
            return "Dict[str, Any]";
        } else if (!cp.isPrimitiveType) {
            // add model prefix
            hasModelsToImport = true;
            modelImports.add(cp.dataType);
            exampleImports.add(cp.dataType);
            return cp.dataType;
        } else if (cp.getContent() != null) {
            LinkedHashMap<String, CodegenMediaType> contents = cp.getContent();
            for (String key : contents.keySet()) {
                CodegenMediaType cmt = contents.get(key);
                // TODO process the first one only at the moment
                if (cmt != null)
                    return getPydanticType(cmt.getSchema(), typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, classname);
            }
            throw new RuntimeException("Error! Failed to process getPydanticType when getting the content: " + cp);
        } else {
            throw new RuntimeException("Error! Codegen Parameter not yet supported in getPydanticType: " + cp);
        }
    }


    /*
     * Gets the pydantic type given a Codegen Property
     *
     * @param cp codegen property
     * @param typingImports typing imports
     * @param pydantic pydantic imports
     * @param datetimeImports datetime imports
     * @param modelImports model imports
     * @param exampleImports example imports
     * @param postponedModelImports postponed model imports
     * @param postponedExampleImports postponed example imports
     * @param classname class name
     * @return pydantic type
     *

View on GitHub (pinned to fcec517be3)

Solutions

  1. Add an explicit schema to the parameter, e.g. schema: { type: string }
  2. Inline or fix the parameter $ref so it resolves to a schema-bearing definition
  3. Validate the spec with Spectral before generating to catch schema-less parameters early

Example fix

# before
parameters:
  - name: q
    in: query

# after
parameters:
  - name: q
    in: query
    schema:
      type: string
Defensive patterns

Strategy: validation

Validate before calling

// JS: every parameter needs a schema or $ref before python-pydantic-v1 generation
for (const item of Object.values(spec.paths || {})) {
  for (const op of Object.values(item)) {
    for (const p of (op && op.parameters) || []) {
      if (!p.schema && !p.$ref) fail(`parameter '${p.name || '?'}' missing schema`);
    }
  }
}

Try / catch

try { generator.generate(); } catch (RuntimeException e) { if (String.valueOf(e.getMessage()).contains("Codegen Parameter not yet supported")) { /* add schema to the parameter printed in the message */ } throw e; }

Prevention

When it happens

Trigger: A query/header/path/collection-format parameter with no schema so dataType is unset, e.g. { name: q, in: query } without schema, when generating with -g python-pydantic-v1.

Common situations: Specs with missing schema blocks on parameters; $ref parameter components without schemas; converted specs from tools that omit schemas.

Related errors


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