aj-foster / open-api-generator

Open API code generator for Elixir
MIT License
97 stars 13 forks source link

key "mapping" not found in: %{"propertyName" => "extractor"} #31

Closed addstar34 closed 9 months ago

addstar34 commented 10 months ago

Thanks for your library. It looks great so I was testing out but am getting this error:

** (KeyError) key "mapping" not found in: %{"propertyName" => "extractor"}
    :erlang.map_get("mapping", %{"propertyName" => "extractor"})
    (oapi_generator 0.1.0-rc.3) lib/open_api/spec/schema/discriminator.ex:27: OpenAPI.Spec.Schema.Discriminator.decode/2
    (oapi_generator 0.1.0-rc.3) lib/open_api/reader/state.ex:111: OpenAPI.Reader.State.with_path/4
    (oapi_generator 0.1.0-rc.3) lib/open_api/spec/schema.ex:138: OpenAPI.Spec.Schema.decode/2
    (oapi_generator 0.1.0-rc.3) lib/open_api/reader/state.ex:180: OpenAPI.Reader.State.with_schema_ref/3
    (oapi_generator 0.1.0-rc.3) lib/open_api/reader/state.ex:111: OpenAPI.Reader.State.with_path/4
    (oapi_generator 0.1.0-rc.3) lib/open_api/spec/components.ex:129: anonymous fn/2 in OpenAPI.Spec.Components.decode_schemas/2
    (stdlib 5.1.1) maps.erl:416: :maps.fold_1/4
    (oapi_generator 0.1.0-rc.3) lib/open_api/reader/state.ex:111: OpenAPI.Reader.State.with_path/4
    (oapi_generator 0.1.0-rc.3) lib/open_api/spec/components.ex:43: OpenAPI.Spec.Components.decode/2
    (oapi_generator 0.1.0-rc.3) lib/open_api/reader/state.ex:111: OpenAPI.Reader.State.with_path/4
    (oapi_generator 0.1.0-rc.3) lib/open_api/spec.ex:73: OpenAPI.Spec.decode/2
    (elixir 1.15.6) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
    (oapi_generator 0.1.0-rc.3) lib/open_api/reader.ex:104: OpenAPI.Reader.run/1
    (oapi_generator 0.1.0-rc.3) lib/open_api.ex:49: OpenAPI.run/2
    (mix 1.15.6) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.6) lib/mix/cli.ex:92: Mix.CLI.run_task/2
    /Users/adamd/.asdf/installs/elixir/1.15.6-otp-26/bin/mix:2: (file)

The spec I'm using is this https://api.affinda.com/static/v3/api_spec.yaml

aj-foster commented 9 months ago

Hi there! I believe this was fixed by #29. If you have a chance to test off of the latest main branch, please let me know if you still run into trouble. Otherwise, a new release will come soon. ❤️