Skip to content

[BUG] [Normalizer] Missing type information in an error message #22741

@thatsdone

Description

@thatsdone

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
    • I checked using the latest master, but as the input is OpenAPI 3.1.0, currently validation also fails.
  • [x ] Have you searched for related issues/PRs?
    • See above.
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Normalizer outputs the following line when an OpenAPI 3.1.0 API definition was given.
The below {} should be type information.

[main] ERROR o.o.codegen.OpenAPINormalizer - Type {} not yet supported in openapi-normalizer to process OpenAPI 3.1 spec with multiple types.

The above should be like the following saying the type is 'object'.

[main] ERROR o.o.codegen.OpenAPINormalizer - Type object not yet supported in op
enapi-normalizer to process OpenAPI 3.1 spec with multiple types.

The above message is output at below.

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java#L1857

openapi-generator version

I noticed this when I'm using 7.10.0, but and the latest master (7.20.0-SNAPSHOT but almost the same as 7.19.0)
also has the same issue.

OpenAPI declaration file content or url

I'm processing an automotive standard written in OpenAPI 3.1.0 available at:
https://standards.iso.org/iso/17978/
But, the above has 2 issues regarding validation.

Generation Details
Steps to reproduce

Reproducing procedure is complex, because the spec also has issues.
We need to modify at least 2 lines of the OpenAPI definition to reproduce
But as it's an obvious bug, a kind of very low hanging fruit, IMHO

java -jar PATH_TO/openapi-generator-cli.jar generate -g spring -o OUTPUT_DIR ./sovd-api.yaml

Related issues/PRs
Suggest a fix

Append String.valueOf(type) like below.

$ git diff
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java
index 78cb4685dfd..c91802e8e7f 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java
@@ -1854,7 +1854,7 @@ public class OpenAPINormalizer {
                         schema.addAnyOfItem(new BooleanSchema());
                         break;
                     default:
-                        LOGGER.error("Type {} not yet supported in openapi-normalizer to process OpenAPI 3.1 spec with multiple types.");
+                        LOGGER.error("Type {} not yet supported in openapi-normalizer to process OpenAPI 3.1 spec with multiple types.", String.valueOf(type));
                         LOGGER.error("Please report the issue via https://github.com/OpenAPITools/openapi-generator/issues/new/.");
                 }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions