Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error creating hash file when trying to retrieve an OpenAPI specification file from a private GitLab repository #20723

Open
4 of 6 tasks
eg-sibirev opened this issue Feb 24, 2025 · 1 comment

Comments

@eg-sibirev
Copy link

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

Error creating hash file when trying to retrieve an OpenAPI specification file from a private GitLab repository

openapi-generator version

7.10.0

OpenAPI declaration file content or url

any file

Generation Details

Java, maven

Steps to reproduce

According to the GitLab API, to retrieve a file from the repository, the following URL format should be used:
https://gitlab.company.com/api/v4/projects/2233/repository/files/openapi.yml/raw?ref=develop&private_token=glpat-xxxYYYyyyZZZ
However, it is recommended to send the PRIVATE_TOKEN as a header.

When generating the API and DTO, the following error occurs:

java.io.FileNotFoundException: [PATH]\target\generated-sources\.openapi-generator\raw?ref=develop&private_token=glpat-xxxYYYyyyZZZ-default.sha256 (Syntax error in file name, folder name, or volume label) at java.io.FileOutputStream.open0 (Native Method) at java.io.FileOutputStream.open (FileOutputStream.java:289) at java.io.FileOutputStream.<init> (FileOutputStream.java:230) 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:137) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:299) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:963) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:296) at org.apache.maven.cli.MavenCli.main (MavenCli.java:199) at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103) at java.lang.reflect.Method.invoke (Method.java:580) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) at org.codehaus.classworlds.Launcher.main (Launcher.java:47)

Despite this error, the API and DTO are generated successfully.

Related issues/PRs
Suggest a fix

The issue is likely due to the fact that when using a similar URL, the last section of the URL is used as the name for the hash file.

@eg-sibirev
Copy link
Author

Version 7.6.0 doesn't have this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant