Fix some OpenAPI issues (#970)

* Fix #933, update externals docs url to current version

* Fix #962, openApi don't err on nonexistent schema

* Fix #954, make OpenAPI rpc output dependent on user privileges
This commit is contained in:
Steve Chávez
2017-09-25 23:09:52 -07:00
committed by Joe Nelson
parent cf19ad0369
commit 4ba27d84a4
13 changed files with 176 additions and 82 deletions
+6 -1
View File
@@ -14,6 +14,7 @@ turned in configurable behaviour if needed.
Other hardcoded options such as the minimum version number also belong here.
-}
module PostgREST.Config ( prettyVersion
, docsVersion
, readOptions
, corsPolicy
, minimumPgVersion
@@ -33,7 +34,7 @@ import Data.Configurator.Types (Value(..))
import Data.List (lookup)
import Data.Monoid
import Data.Scientific (floatingOrInteger)
import Data.Text (strip, intercalate, lines)
import Data.Text (strip, intercalate, lines, dropAround)
import Data.Text.Encoding (encodeUtf8)
import Data.Text.IO (hPutStrLn)
import Data.Version (versionBranch)
@@ -92,6 +93,10 @@ corsPolicy req = case lookup "origin" headers of
prettyVersion :: Text
prettyVersion = intercalate "." $ map show $ versionBranch version
-- | Version number used in docs
docsVersion :: Text
docsVersion = "v" <> dropAround (== '.') (dropAround (/= '.') prettyVersion)
-- | Function to read and parse options from the command line
readOptions :: IO AppConfig
readOptions = do