Fix Swagger

This commit is contained in:
Filip Gralinski 2021-02-15 13:48:58 +01:00
parent 106e076bc8
commit 64a5bd52be
2 changed files with 6 additions and 4 deletions

View File

@ -70,7 +70,7 @@ instance ToJSON Parameter where
instance ToSchema Parameter where
declareNamedSchema _ = do
stringSchema <- declareSchemaRef (DPR.Proxy :: DPR.Proxy String)
return $ NamedSchema (Just "SubmissionInfo") $ mempty
return $ NamedSchema (Just "Parameter") $ mempty
& type_ .~ SwaggerObject
& properties .~
fromList [ ("name", stringSchema),
@ -92,7 +92,7 @@ instance ToSchema VariantView where
stringSchema <- declareSchemaRef (DPR.Proxy :: DPR.Proxy [String])
evaluationsSchema <- declareSchemaRef (DPR.Proxy :: DPR.Proxy [EvaluationView])
paramsSchema <- declareSchemaRef (DPR.Proxy :: DPR.Proxy [Parameter])
return $ NamedSchema (Just "SubmissionInfo") $ mempty
return $ NamedSchema (Just "Variant") $ mempty
& type_ .~ SwaggerObject
& properties .~
fromList [ ("id", intSchema),
@ -117,7 +117,7 @@ instance ToSchema QueryResultView where
declareNamedSchema _ = do
submissionInfoSchema <- declareSchemaRef (DPR.Proxy :: DPR.Proxy FullSubmissionInfo)
variantViewsSchema <- declareSchemaRef (DPR.Proxy :: DPR.Proxy [VariantView])
return $ NamedSchema (Just "SubmissionInfo") $ mempty
return $ NamedSchema (Just "QueryResult") $ mempty
& type_ .~ SwaggerObject
& properties .~
fromList [ ("submissionInfo", submissionInfoSchema),
@ -334,7 +334,7 @@ declareQuerySwagger = do
queryApi :: Swagger
queryApi = spec & definitions .~ defs
where
(defs, spec) = runDeclare declareLeaderboardSwagger mempty
(defs, spec) = runDeclare declareQuerySwagger mempty
priorityLimitForViewVariant :: Int

View File

@ -5,6 +5,7 @@ import Import
import Data.Swagger
import Handler.ListChallenges
import Handler.ShowChallenge
import Handler.Query
import Control.Lens hiding ((.=))
@ -18,6 +19,7 @@ apiDescription = generalApi
<> allSubmissionsApi
<> mySubmissionsApi
<> challengeReadmeInMarkdownApi
<> queryApi
generalApi :: Swagger
generalApi = (mempty :: Swagger)