brendanhay/gogol

Improve typing on table creation

Opened this issue · 0 comments

I want to create a simple table and get a runtime error. BigQuery service is not bothered with explaining what actually is missing and Haskell type system pass incomplete query.

:set -XOverloadedStrings
:set -XGADTs
:set -XTypeFamilies
import Control.Lens ((&), (.~), (<&>), view, set)
import Network.Google
import Network.Google.BigQuery
bqe cmd = runResourceT (runGoogle e (send cmd))
bqe $ tablesInsert (table & (tabFriendlyName .~ (Just "tbl2")) & (tabId .~ (Just "tbl2")) & (tabSchema .~ (Just (tableSchema & tsFields .~ [tableFieldSchema & tfsName .~ (Just "name") & tfsType .~ (Just "STRING")])))) "ds2" prjId

*** Exception: ServiceError (ServiceError' {_serviceId = ServiceId "bigquery:v2", _serviceStatus = Status {statusCode = 400, statusMessage = "Bad Request"}, _serviceHeaders = [("Vary","Origin"),("Vary","X-Origin"),("Vary","Referer"),("Content-Type","application/json; charset=UTF-8"),("Content-Encoding","gzip"),("Date","Wed, 12 Aug 2020 17:55:49 GMT"),("Server","ESF"),("Cache-Control","private"),("X-XSS-Protection","0"),("X-Frame-Options","SAMEORIGIN"),("X-Content-Type-Options","nosniff"),("Alt-Svc","h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43""),("Transfer-Encoding","chunked")], _serviceBody = Just "{\n "error": {\n "code": 400,\n "message": "Required parameter is missing",\n "errors": [\n {\n "message": "Required parameter is missing",\n "domain": "global",\n "reason": "required"\n }\n ],\n "status": "INVALID_ARGUMENT"\n }\n}\n"})

gogol version is 0.5