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

Replace spec file type detection with mime type instead of file extension #176

Closed
fkjaekel opened this issue Feb 19, 2025 · 1 comment · May be fixed by #179
Closed

Replace spec file type detection with mime type instead of file extension #176

fkjaekel opened this issue Feb 19, 2025 · 1 comment · May be fixed by #179
Labels
bug Something isn't working

Comments

@fkjaekel
Copy link

Description of the bug

Hi,

All my backends are written spring boot. The spec files are generated dynamically and they don't have extensions, for example http://localhost:8088/doc/v2

So I have to download, rename and copy the spec file when I need to use the plugin, which is unproductive.

When I use the openapi generator maven plugin it works fine with extensionless remote specs, and since this plugin also uses openapi-generator-cli.jar, my suggestion is to change the plugin specific logic to detect the if the spec file is json or yaml to validate by the mime type instead of the extension.

Thanks

Steps to reproduce

explained above

Minimal openapi specification

not relevant

Annotation used

not relevant

Expected behavior

explained above

Logs


Screenshots

No response

Platform

Linux

Library version

6.1.0

Flutter version

3.27.2

Flutter channel

stable

Additional context


@fkjaekel fkjaekel added the bug Something isn't working label Feb 19, 2025
@gibahjoe
Copy link
Owner

gibahjoe commented Mar 7, 2025

The update that would be made is to use a HEAD request as a fallback when there is no extension. However, head is not always supported in all servers so it may not fix the issue for you.

Another thing you can look into is using a redirect serve the correct file or even an interceptor.

i.e redirect http://localhost:8088/doc/v2.json to http://localhost:8088/doc/v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants