Haskell-OpenAPI-Code-Generator / Haskell-OpenAPI-Client-Code-Generator

Generate Haskell client code from an OpenAPI 3 specification
46 stars 19 forks source link

Interactive Brokers API seems broken #81

Closed dxtr closed 2 years ago

dxtr commented 2 years ago

So I downloaded the swagger spec from https://www.interactivebrokers.com/api/doc.html, converted it to openapi 3 with https://editor.swagger.io, cleaned it up a little and ran openapi3-code-generator-exe --specification openapi-spec.yml --output-dir ibkr --module-name IBKR with the latest commit from master

The resulting package does not build:

[ 79 of 113] Compiling IBKR.Operations.Get_md_snapshot

/home/dxtr/code/haskell/ibkr/src/IBKR/Operations/Get_md_snapshot.hs:60:501: error:
    • Variable not in scope:
        get_md_snapshotParametersQueryConids
          :: Get_md_snapshotParameters -> a3
    • Perhaps you meant ‘get_md_snapshotParametersQueryFields’ (line 69)
   |
60 |                                                                                                                                                                        | GHC.Base.otherwise -> Data.Either.Left "Missing default response type") response_0) response_0) (IBKR.Common.doCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.pack "GET") (Data.Text.pack "/md/snapshot") [IBKR.Common.QueryParameter (Data.Text.pack "conids") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (get_md_snapshotParametersQueryConids parameters)) (Data.Text.pack "form") GHC.Types.False,
   |

                                                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/home/dxtr/code/haskell/ibkr/src/IBKR/Operations/Get_md_snapshot.hs:100:524: error:
    • Variable not in scope:
        get_md_snapshotParametersQueryConids
          :: Get_md_snapshotParameters -> a2
    • Perhaps you meant ‘get_md_snapshotParametersQueryFields’ (line 69)
    |
100 |                                                                                                                                                                                         | GHC.Base.otherwise -> Data.Either.Left "Missing default response type") response_4) response_4) (IBKR.Common.doCallWithConfiguration config (Data.Text.toUpper GHC.Base.$ Data.Text.pack "GET") (Data.Text.pack "/md/snapshot") [IBKR.Common.QueryParameter (Data.Text.pack "conids") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (get_md_snapshotParametersQueryConids parameters)) (Data.Text.pack "form") GHC.Types.False,
    |

                                                                                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/home/dxtr/code/haskell/ibkr/src/IBKR/Operations/Get_md_snapshot.hs:107:280: error:
    • Variable not in scope:
        get_md_snapshotParametersQueryConids
          :: Get_md_snapshotParameters -> a1
    • Perhaps you meant ‘get_md_snapshotParametersQueryFields’ (line 69)
    |
107 | get_md_snapshotRaw parameters = GHC.Base.id (IBKR.Common.doCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.pack "GET") (Data.Text.pack "/md/snapshot") [IBKR.Common.QueryParameter (Data.Text.pack "conids") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (get_md_snapshotParametersQueryConids parameters)) (Data.Text.pack "form") GHC.Types.False,
    |
                                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/home/dxtr/code/haskell/ibkr/src/IBKR/Operations/Get_md_snapshot.hs:116:303: error:
    • Variable not in scope:
        get_md_snapshotParametersQueryConids
          :: Get_md_snapshotParameters -> a0
    • Perhaps you meant ‘get_md_snapshotParametersQueryFields’ (line 69)
    |
116 |                                     parameters = GHC.Base.id (IBKR.Common.doCallWithConfiguration config (Data.Text.toUpper GHC.Base.$ Data.Text.pack "GET") (Data.Text.pack "/md/snapshot") [IBKR.Common.QueryParameter (Data.Text.pack "conids") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON (get_md_snapshotParametersQueryConids parameters)) (Data.Text.pack "form") GHC.Types.False,
    |
                                                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

--  While building package openapi-0.1.0.0 (scroll up to its section to see the error) using:
      /home/dxtr/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.7 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0 build lib:openapi --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

I'm not quite sure what's happening here. Am I doing something wrong?

I created a repo at https://github.com/dxtr/IBKR-openapi-broken with everything

EDIT: I could not get the formatting right so I am attaching a file with them too: errors.txt

dxtr commented 2 years ago

I fixed it by manually adding get_md_snapshotParametersQueryConids in Get_md_snapshot.hs but why isn't it added to begin with?

joel-bach commented 2 years ago

This looks like a bug, thank you for reporting this. I'll have a look.

joel-bach commented 2 years ago

Update: I have identified the problem and I am working on a fix, but since I have very limited time currently, I am not sure when I will be able to deliver it.

joel-bach commented 2 years ago

Hey there, I created a fix for this here (it is on master). Feel free to test it and reopen this issue if the problem persists.