Skip to content

Instantly share code, notes, and snippets.

@Xiphoseer
Created July 15, 2024 12:19
Show Gist options
  • Save Xiphoseer/05c1b92d36ff3beef1e7e84fc476ccf9 to your computer and use it in GitHub Desktop.
Save Xiphoseer/05c1b92d36ff3beef1e7e84fc476ccf9 to your computer and use it in GitHub Desktop.
OpenAPI schemaMappings generator bug
openapi: 3.0.3
info: { title: "Demo - OpenAPI 3.0", version: 1.0.0 }
servers: [{ url: "http://localhost:8080" }]
paths:
/thing:
get:
summary: Get a thing
responses:
'200':
description: Successful operation
content:
application/json:
schema: { $ref: '#/components/schemas/ThingWrapper' }
components:
schemas:
ThingWrapper:
type: object
properties:
inner: { $ref: '#/components/schemas/Thing' }
Thing:
type: object
properties:
text: { type: string }
inputSpec: api.yaml
generatorName: java
schemaMappings:
ThingWrapper: Wrapper<Thing>
Download 7.7.0 ...
Downloaded 7.7.0
Did set selected version to 7.7.0
Exception in thread "main" java.lang.NullPointerException: generator name must be specified
at java.base/java.util.Objects.requireNonNull(Objects.java:360)
at org.apache.commons.lang3.Validate.notEmpty(Validate.java:388)
at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:643)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:744)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:527)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
PS C:\Users\dseiler\Dev\GitHub\Xiphoseer\openapi-generator-bug-XXXX> openapi-generator-cli generate -c .\config.yaml
[main] INFO o.o.codegen.DefaultGenerator - Generating with dryRun=false
[main] INFO o.o.c.ignore.CodegenIgnoreProcessor - No .openapi-generator-ignore file found.
[main] INFO o.o.codegen.DefaultGenerator - OpenAPI Generator: java (client)
[main] INFO o.o.codegen.DefaultGenerator - Generator 'java' is considered stable.
[main] INFO o.o.c.languages.AbstractJavaCodegen - Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"' (Linux/Mac)
[main] INFO o.o.c.languages.AbstractJavaCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[main] INFO o.o.c.languages.AbstractJavaCodegen - Processing operation null
Exception in thread "main" java.lang.RuntimeException: Could not process model 'ThingWrapper'.Please make sure that your schema is correct!
at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:530)
at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:449)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:1302)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:535)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.nio.file.InvalidPathException: Illegal char <<> at index 53: .\src\main\java\org\openapitools\client\model\Wrapper<Thing>.java
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:204)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:175)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:231)
at java.base/java.nio.file.Path.of(Path.java:148)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:481)
... 5 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment