Skip to content

Examples not working #221

@n-0

Description

@n-0

Using Fedora 30 with Erlang/OTP 21, Elixir 1.9.0 and open_api_spex v 3.6.0 the following error occurs with my setup, when trying out the examples with
plug
iex -S mix
phoenix
mix phx.server

Error Message:
Phoenix
[error] #PID<0.XXX.0> running PhoenixAppWeb.Endpoint (connection #PID<0.XXX.0>, stream id 1) terminated Server: localhost:4000 (http) Request: GET /api/users ** (exit) an exception was raised: ** (KeyError) key :minimum not found in: %OpenApiSpex.Parameter{allowEmptyValue: nil, allowReserved: nil, content: nil, deprecated: nil, description: "User ID", example: 123, examples: nil, explode: nil, in: :path, name: :id, required: nil, schema: nil, style: nil} (stdlib) :maps.update(:minimum, 1, %OpenApiSpex.Parameter{allowEmptyValue: nil, allowReserved: nil, content: nil, deprecated: nil, description: "User ID", example: 123, examples: nil, explode: nil, in: :path, name: :id, required: nil, schema: nil, style: nil}) (open_api_spex) lib/open_api_spex/parameter.ex:10: anonymous fn/2 in OpenApiSpex.Parameter.__struct__/1 (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3 (open_api_spex) lib/open_api_spex/parameter.ex:10: OpenApiSpex.Parameter.__struct__/1 (elixir) lib/kernel.ex:2147: Kernel.struct!/2 (open_api_spex) lib/open_api_spex/operation.ex:103: OpenApiSpex.Operation.parameter/5 (phoenix_app) lib/phoenix_app_web/controllers/user_controller.ex:71: PhoenixAppWeb.UserController.show_operation/0 (open_api_spex) lib/open_api_spex/path_item.ex:77: anonymous fn/1 in OpenApiSpex.PathItem.from_valid_routes/1 (elixir) lib/enum.ex:1336: Enum."-map/2-lists^map/1-0-"/2 (open_api_spex) lib/open_api_spex/path_item.ex:76: OpenApiSpex.PathItem.from_valid_routes/1 (open_api_spex) lib/open_api_spex/paths.ex:23: anonymous fn/1 in OpenApiSpex.Paths.from_router/1 (elixir) lib/enum.ex:1340: anonymous fn/3 in Enum.map/2 (stdlib) maps.erl:257: :maps.fold_1/3 (elixir) lib/enum.ex:1964: Enum.map/2 (open_api_spex) lib/open_api_spex/paths.ex:23: OpenApiSpex.Paths.from_router/1 (phoenix_app) lib/phoenix_app_web/api_spec.ex:13: PhoenixAppWeb.ApiSpec.spec/0 (open_api_spex) lib/open_api_spex/plug/put_api_spec.ex:48: OpenApiSpex.Plug.PutApiSpec.build_spec/1 (open_api_spex) lib/open_api_spex/plug/put_api_spec.ex:28: OpenApiSpex.Plug.PutApiSpec.call/2 (phoenix_app) PhoenixAppWeb.Router.api/2 (phoenix_app) lib/phoenix_app_web/router.ex:1: PhoenixAppWeb.Router.__pipe_through1__/1 .

Plug

15:02:52.576 [error] #PID<0.XXX.0> running PlugApp.Router (cowboy_protocol) terminated Server: localhost:4000 (http) Request: GET /api/users ** (exit) an exception was raised: ** (KeyError) key :minimum not found in: %OpenApiSpex.Parameter{allowEmptyValue: nil, allowReserved: nil, content: nil, deprecated: nil, description: "User ID", example: 123, examples: nil, explode: nil, in: :path, name: :id, required: true, schema: nil, style: nil} (stdlib) :maps.update(:minimum, 1, %OpenApiSpex.Parameter{allowEmptyValue: nil, allowReserved: nil, content: nil, deprecated: nil, description: "User ID", example: 123, examples: nil, explode: nil, in: :path, name: :id, required: true, schema: nil, style: nil}) (open_api_spex) lib/open_api_spex/parameter.ex:10: anonymous fn/2 in OpenApiSpex.Parameter.__struct__/1 (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3 (open_api_spex) lib/open_api_spex/parameter.ex:10: OpenApiSpex.Parameter.__struct__/1 (elixir) lib/kernel.ex:2147: Kernel.struct!/2 (open_api_spex) lib/open_api_spex/operation.ex:103: OpenApiSpex.Operation.parameter/5 (plug_app) lib/plug_app/user_handler.ex:56: PlugApp.UserHandler.Show.open_api_operation/1 (open_api_spex) lib/open_api_spex/path_item.ex:77: anonymous fn/1 in OpenApiSpex.PathItem.from_valid_routes/1 #

The error occurs while calling http://localhost:4000/swaggerui to explore the API. Sending a POST to http://localhost:4000/api/users seems to be fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions