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

make serving path configurable #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xetalr
Copy link

@xetalr xetalr commented Sep 14, 2024

Sometimes there is a need to use a custom path for Swagger UI. It is hard-coded as api-docs at the moment. Here is proposed implementation.

@@ -8,7 +8,7 @@
%% Handlers
-export([resource_exists/2, previously_existed/2, moved_permanently/2]).

-type state() :: #{}.
-type state() :: {file, string()}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not #{file := string()}?

Copy link
Author

@xetalr xetalr Sep 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Just used what was already passed. So this is a fix for type spec. Dialyzer is happy now.

url: window.location.origin + "/api-docs/swagger.json",
url: window.location.toString().replace("/index.html", "/swagger.json"),
Copy link
Collaborator

@paulo-ferraz-oliveira paulo-ferraz-oliveira Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this change, please?

Also, I can't remember, but are we testing this somewhat?

You might want to look into up_swagger.sh because there's logic for this file, there.

Comment on lines -39 to +40
{file, StaticFiles ++ "/index.html"},
{file, Path ++ "/index.html"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to not be able to follow this change. Would you elaborate, please?

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

Successfully merging this pull request may close these issues.

3 participants