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

How to include a port number in the routes? #570

Open
GildedHonour opened this issue Nov 12, 2023 · 0 comments
Open

How to include a port number in the routes? #570

GildedHonour opened this issue Nov 12, 2023 · 0 comments

Comments

@GildedHonour
Copy link

GildedHonour commented Nov 12, 2023

defmodule MyAppWeb.MyApi.ApiSpec do
  alias OpenApiSpex.{Components, Info, OpenApi, Paths, Server}
  @behaviour OpenApi

  @impl OpenApi
  def spec do
    %OpenApiSpex.OpenApi{
      servers: [
        OpenApiSpex.Server.from_endpoint(MyAppWeb.Endpoint)
      ],
      info: %Info{
        title: "API",
        version: "1.0"
      },
      paths: Paths.from_router(MyAppWeb.Router),
      components: %Components{
        securitySchemes: %{
          "bearer_auth" => %OpenApiSpex.SecurityScheme{
            type: "apiKey",
            name: "Authorization",
            in: "header",
            # TODO
            # scheme: "Bearer",
            # description: "API Key",
    }}}}
    |> OpenApiSpex.resolve_schema_modules()
  end

On localhost, at "swagger_ui" all the routes get generated with the port 80 - without a port, that is. But my web app runs on the other port. How will I make it include the port number explicitly?

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

No branches or pull requests

1 participant