JS code generation fails when Api contains BasicAuth #672

Open
kseo opened this Issue Jan 17, 2017 · 6 comments

Projects

None yet

4 participants

@kseo
kseo commented Jan 17, 2017

writeJSForAPI fails to type check after I add BasicAuth to my api.

/Users/kseo/KodeBoxProjects/kodebox-server/jsgen/Main.hs: 21, 15
• No instance for (servant-foreign-0.8.1:Servant.Foreign.Internal.HasForeign
                     NoTypes
                     Servant.API.ContentTypes.NoContent
                     (Servant.API.BasicAuth.BasicAuth
                        "kodebox-realm" Kodebox.Server.Types.Session
                      Servant.API.Sub.:> Kodebox.Server.Api.PrivateApi))
    arising from a use of ‘writeJSForAPI’
• In the expression:
    writeJSForAPI
      restApi vanillaJS (joinPath [outputDir, "Kodebox.js"])
  In an equation for ‘writeJSCode’:
      writeJSCode
        = writeJSForAPI
            restApi vanillaJS (joinPath [outputDir, "Kodebox.js"])
@arianvp
Member
arianvp commented Jan 17, 2017

Hmm I remember I implemented this at some point, but perhaps it never ended up in master.

@arianvp arianvp self-assigned this Jan 17, 2017
@arianvp arianvp added this to the 0.10 milestone Jan 17, 2017
@phadej
Member
phadej commented Jan 19, 2017 edited

Related/Duplicates: #463 #672 #465

@arianvp you have an opportunity to close 3 issues with one PR! See also #682

@arianvp
Member
arianvp commented Jan 31, 2017

@phadej Due to exams wasn't able to finish this week. however I don't think this should block the 0.10 release. We can do a 0.10.1 release as the changes are non-breaking

@arianvp arianvp removed this from the 0.10 milestone Jan 31, 2017
@phadej
Member
phadej commented Jan 31, 2017

@arianvp ack.

@joaomilho

Just had the same issue. How can I help?

@arianvp
Member
arianvp commented Feb 9, 2017

A HasForeign instance has to be written for the BasicAuth stuff. Which generates enough information such that servant-js can write auth client code.

Which should be the trivial part: https://stackoverflow.com/questions/5507234/how-to-use-basic-auth-with-jquery-and-ajax

I am a bit busy, so I haven't gotten around doing it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment