Commit Graph
1208 Commits
Author SHA1 Message Date
Joe Nelson 2f8ac24128 Do not share JWT secret with SQL 2016-09-24 23:40:54 -07:00
Joe Nelson 71bc666a8e Forgot jwt fixture, also hlint fix 2016-09-24 21:32:47 -07:00
Joe Nelson 12a8c682bd Use sql to generate jwt, rather than custom haskell 2016-09-24 21:32:47 -07:00
Joe Nelson 62ed9e2c4d Do not require jwt secret, but die on auth without it 2016-09-24 21:28:08 -07:00
Joe Nelson 449480bf01 Require JWT secret, remove default, optionally read from file
Fixes #474, fixes #495 when file is used
2016-09-24 21:28:08 -07:00
Joe Nelson 7bf5b0106d Semantic WWW-Authenticate headers for problematic JWT
Adapting an OAuth 2.0 convention from RFC 6750 for use with JWT
2016-09-24 21:28:08 -07:00
Joe Nelson fb5fce026d Issue http 401 for expired jwt
Fixes #512
2016-09-24 21:28:08 -07:00
Joe NelsonandGitHub 35da4809d4 Merge pull request #706 from begriffs/func-descriptions
Include RPC endpoints in OpenAPI output
2016-09-24 20:38:42 -07:00
Joe Nelson a88a704bef Parse proc arg definitions that have multi-word types 2016-09-22 23:30:47 -07:00
Joe Nelson 539df21627 WIP: more comprehensive test of rpc args
Breaks toks2arg
2016-09-21 23:54:08 -07:00
Joe Nelson 0314f4bdea First test of OpenAPI RPC params 2016-09-21 20:34:03 -07:00
Joe Nelson ffd2859cba Changelog 2016-09-11 16:23:41 -07:00
Joe Nelson 362ad7b7d0 Hlint adjustment 2016-09-11 16:22:32 -07:00
Joe Nelson 25c2cd1f2d Note which rpc params are optional 2016-09-11 15:15:38 -07:00
Joe Nelson 466090c79b Expose stored proc args properly as json body param 2016-09-11 12:33:19 -07:00
Joe Nelson b9777dec35 Include proc parama and their types in openapi 2016-09-08 23:00:52 -07:00
Joe Nelson f49c6aa0f3 WIP: show procs in OpenAPI description
Thanks @LogvinovLeon
2016-09-08 21:23:16 -07:00
Joe NelsonandGitHub f3b79bcc40 Use table alias unlikely to conflict with a column name (#705) 2016-09-08 08:16:47 -07:00
Joe NelsonandGitHub af75988dd4 No count by default (#700)
* WIP: disable counting total table size by default

* Remove commented tests since PUT is no longer supported

* Fix tests for invalid range which require count

* Do not report count in PATCH response if not asked

* Return count of deleted items only if asked

* Return count for bulk insert when requested

* Changelog entry
2016-09-04 10:31:24 -07:00
Joe NelsonandGitHub 7278507c42 Use comma rather than semicolon to split header values (#698) 2016-08-21 15:26:00 -07:00
Diogo BiazusandJoe Nelson 6f737056a2 Protolude completion in library and executable (#697) 2016-08-21 15:10:19 -07:00
Ben GamariandJoe Nelson 298753d59e App: Remove erroneous import of Data.Monoid (#687) 2016-08-19 16:15:41 -07:00
Joe NelsonandGitHub 1d5a0e4316 Per-route content negotiation, and OpenAPI only for root (#693)
* WIP: remove non-openapi root spec

* Refactor ContentType

Different endpoints will favor one type over another

* Permit different Accept headers per endpoint

* Lint

* Add charset to Content-Type only when used as a header

Keep it out of error messages

* Accept: */* is last resort, not first

* Changelog

* makeMimeList consistently

* Remove schema description from OPTIONS response
2016-08-19 16:07:22 -07:00
Erlend HambergandJoe Nelson 35c5b190b4 Singular response for PATCH request (#634)
* Allow a singular entity to be returned from an update

Since a `PATCH` will be an update that could affect many rows, there might be
more than one object returned. By allowing asking for a singular response,
the/an object will be returned instead of a list. This is useful in cases when
the `PATCH` is against single entity (i.e. `/items?pkey=eq.99`).

* Add tests for plurality=singular for `PATCH` requests

* Disallow updating more than one row if `plurality=singular`

As discussed in #634, we don't want to allow updating several rows with
a `PATCH` request when the `Prefer` header specifies
`return=representation;plurality=singular` as this would almost
certainly be a client error.

* Add test for patching multiple objects with singular response

Patching > 1 object with `return=representation;plurality=singular`
should return `400 Bad Request`.

* Only add singleton range for read API requests

* Disallow inserting more than one row if `plurality=singular`

Disallow inserting several rows with a `POST` request when the `Prefer`
header specifies `return=representation;plurality=singular` as this
would almost certainly be a client error.

* Only import `q` from `Text.InterpolatedString.Perl6`

* Update OpenAPI response for PATCH/POST to mention `plurality=singular`

The OpenAPI response for PATCH/POST requests now includes the `Prefer` value
`return=representation;plurality=singular`.

* Add entry in changelog
2016-08-19 14:02:14 -07:00
Diogo BiazusandJoe Nelson df6cbc4afa Protolude second movement (#677)
* Replace Prelude import for Protolude in middleware

* Remove qualifier from Text type

* Replace Prelude for Protolude, replace 'cs' for 'toS' calls, also change some name bindings

* Replace Prelude in main for Protolude. Replace error calls for panic calls. Also replace cs for toS

* Replace Prelude for Protolude

* Replace Prelude for Protolude in OpenAPI
2016-07-23 12:20:36 -07:00
Joe NelsonandGitHub d93d07795b Merge pull request #675 from begriffs/bump-hjsonschema
Use real version of hjsonschema
2016-07-18 12:19:22 -07:00
Joe Nelson c98450d1d5 Use real version of hjsonschema
Its raw commit on github no longer exists
2016-07-18 11:37:38 -07:00
Joe NelsonandGitHub b6e100096d Merge pull request #672 from begriffs/cache-warning
Add schema cache freshness warning
2016-07-16 17:04:15 -07:00
Joe Nelson 338c4de8b4 Add schema cache freshness warning 2016-07-11 16:46:39 -07:00
Joe NelsonandGitHub b5d720e091 Merge pull request #649 from hudayou/proxy-awareness
Add proxy awareness for OpenAPI spec generation
2016-07-07 08:25:30 -07:00
Joe NelsonandGitHub 2b1ca9f5b7 Merge pull request #662 from begriffs/raise-400
Translate raise_exception to http 400
2016-07-07 08:15:26 -07:00
Jacky Hu 1fef1991ef Add proxy awareness for OpenAPI spec generation
Proxy uri from command line options takes precedence over host and port
2016-07-07 19:20:40 +08:00
Joe Nelson e4cf1ce207 Translate raise_exception to http 400
Fixes #661
2016-07-06 21:48:32 -07:00
Joe NelsonandGitHub 63046baffd Merge pull request #620 from ruslantalpa/rpc_refactor
Rpc refactor
2016-07-06 20:51:05 -07:00
Joe NelsonandGitHub d102d954ac Merge pull request #657 from diogob/protolude-first-fugues
Protolude first fugues
2016-06-30 08:27:58 -07:00
Diogo Biazus 578ae6b5dd Import GHC.Show without qualifying it 2016-06-30 08:35:42 -04:00
Joe NelsonandGitHub f7aa8b7ad5 Merge pull request #656 from diogob/simplify-pTreePath
Remove unnecessary string conversions
2016-06-29 20:37:15 -07:00
Diogo Biazus 7b9eb86fd0 Stop running openpi test until we figure out a way to run it in circle without a suite timeout 2016-06-29 10:14:38 -04:00
Diogo Biazus b17fa09393 Add explicit import Prelude to remaining modules to compile and run specs 2016-06-29 09:26:47 -04:00
Diogo Biazus 0e172b8030 Port Auth to prolude 2016-06-29 09:25:57 -04:00
Diogo Biazus 3308012dcf Add protolude to dependencies, include NoImplicitPrelude in default extensions and port Error module to protolude. 2016-06-29 09:25:57 -04:00
Diogo Biazus 376b67be9e Remove unnecessary string conversions 2016-06-29 00:18:29 -04:00
Ruslan Talpa 72aa664b61 CHANGELOG 2016-06-28 12:20:53 +03:00
Ruslan Talpa 1372de6f43 query simplification by @diogob 2016-06-28 12:18:12 +03:00
Ruslan Talpa 430baf23b9 embed entities to the results returned by procs 2016-06-28 12:09:58 +03:00
Ruslan Talpa 2f166088c8 response shaping and filtering for rpc proc calls 2016-06-28 12:09:58 +03:00
Ruslan Talpa 744bbf7203 cache the names of functions returning JWT and avoid extra query on each rpc call 2016-06-28 12:09:58 +03:00
Ruslan Talpa a253ff325d don't check if proc exists, just call it and return 400 if it does not 2016-06-28 12:09:57 +03:00
Joe NelsonandGitHub 67668a02c2 Merge pull request #653 from bgamari/master
Add version bounds on http-types
2016-06-26 09:47:12 -07:00
Ben Gamari cd27e9dcde Add version bounds on http-types
Postgresst uses hAllow, which was only added in 0.9.
2016-06-26 06:02:30 -04:00