Skip to content

[BUG] openapi-generator-maven-plugin 7.7.0 or 7.8.0 on Windows #19724

@c4rth

Description

@c4rth

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When using the openapi-generator-maven-plugin on Windows with an inputSpec as an URL with query parameter(s), the plugin failed.
The plugin tries to create a file named 'swagger.yaml?resolved=true-petclinic.sha256' which is not allowed on Windows.

On MacOS, there is no issue.

openapi-generator version
  • openapi-generator-maven-plugin: 7.7.0 and 7.8.0 : errors
  • openapi-generator-maven-plugin: 7.6.0 : ok
Steps to reproduce

In the pom.xml:

<plugin>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <version>7.8.0</version>
    <executions>
        <execution>
            <id>petclinic</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <generatorName>java</generatorName>
                <library>webclient</library>
                  <inputSpec>https://api.swaggerhub.com/apis/JPABuddy/Petclinic/1.0.6/swagger.yaml?resolved=true</inputSpec>
                <modelPackage>org.c4rth.api.model</modelPackage>
                <apiPackage>org.c4rth.api</apiPackage>
                <configOptions>
                    <useJakartaEe>true</useJakartaEe>
                </configOptions>
            </configuration>
        </execution>
    </executions>
</plugin>

Execute the maven plugin.

Exception:

java.io.FileNotFoundException: R:\projects\...\target\generated-sources\openapi\.openapi-generator\swagger.yaml?resolved=true-petclinic.sha256 (The filename, directory name, or volume label syntax is incorrect)
    at java.io.FileOutputStream.open0 (Native Method)
    at java.io.FileOutputStream.open (FileOutputStream.java:293)
    at java.io.FileOutputStream.<init> (FileOutputStream.java:235)
    at com.google.common.io.Files$FileByteSink.openStream (Files.java:197)
    at com.google.common.io.Files$FileByteSink.openStream (Files.java:185)
    at com.google.common.io.ByteSink$AsCharSink.openStream (ByteSink.java:152)
    at com.google.common.io.CharSink.write (CharSink.java:99)
    at org.openapitools.codegen.plugin.CodeGenMojo.execute (CodeGenMojo.java:979)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:41)
Related issues/PRs
Suggest a fix

The filename generation for the sha256 should replace/remove invalid characters for the executing platform or not take the URL part with the query parameters (as in version 7.6.0)

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