h*)+&      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^1.2.1  Safe-Inferred6servant-swagger$Pretend that 'SourceT m a' is '[a]'. Safe-Inferred /01 servant-swaggerExtract a list of "body" types for a specific content-type from a servant API. To extract unique types see ._ is removed from the list and not tested. (This allows for leaving the body completely empty on responses to requests that only accept 'application/json', while setting the content-type in the response accordingly.)servant-swagger c cs a as adds type a to the list as only if c is in cs.servant-swaggerExtract a list of unique "body" types for a specific content-type from a servant API.servant-swagger&Remove element from a type-level list.servant-swagger)Remove duplicates from a type-level list.servant-swaggerCheck whether a type is a member of a list of types. This is a type-level analogue of `. servant-swaggerAppend two type-level lists. servant-swaggerApply (e :>) to every API in xs. servant-swaggerCheck that every element of xs is an endpoint of api. servant-swaggerCheck whether sub is a sub API of api.servant-swagger&Build a list of endpoints from an API.     Safe-Inferred"#/01yservant-swaggerMethods, available for Swagger.servant-swagger3Generate a Swagger specification for a servant API.9To generate Swagger specification, your data types need a and/or b instances.a is used for c, d and e. b is used for f and response data types.*You can easily derive those instances via Generic". For more information, refer to  http://hackage.haskell.org/package/swagger2/docs/Data-Swagger.htmlswagger2 documentation.Example: newtype Username = Username String deriving (Generic, ToText) instance ToParamSchema Username data User = User { username :: Username , fullname :: String } deriving (Generic) instance ToJSON User instance ToSchema User type MyAPI = QueryParam "username" Username :> Get '[JSON] User mySwagger :: Swagger mySwagger = toSwagger (Proxy :: Proxy MyAPI) servant-swagger3Generate a Swagger specification for a servant API.servant-swagger/All operations of sub API. This is similar to g but ensures that operations indeed belong to the API at compile time.servant-swaggerMake a singleton Swagger spec (with only one endpoint). For endpoints with no content see .servant-swaggerMake a singletone h: spec (with only one endpoint) and with no content schema.servant-swaggerLike - but with explicit schema reference. Unlike  this function does not update i.servant-swagger-Add parameter to every operation in the spec.servant-swagger)Add a tag to every operation in the spec. servant-swagger:Add accepted content types to every operation in the spec.!servant-swagger-Format given text as inline code in Markdown.&servant-swagger"This instance is an approximation.-servant-swaggerSwagger Spec doesn't have a notion of CaptureAll, this instance is the best effort.0servant-swaggerj5 combinator does not change our specification at all.1servant-swaggerk5 combinator does not change our specification at all.2servant-swaggerl5 combinator does not change our specification at all.3servant-swaggerm5 combinator does not change our specification at all.4servant-swaggern5 combinator does not change our specification at all.5servant-swaggero5 combinator does not change our specification at all.6servant-swaggerp5 combinator does not change our specification at all.<servant-swaggerJservant-swagger@since TODOservant-swaggerPart of a servant API.servant-swaggerThe whole servant API.servant-swaggerEndpoint path.servant-swagger,Method, content-types, headers and response.servant-swaggerEndpoint path.servant-swagger,Method, content-types, headers and response.servant-swaggerEndpoint path.servant-swaggerMethod !"#$ !"#$ Safe-Inferred/01Qservant-swagger4Map a list of constrained types to a list of values.tmap (Proxy :: Proxy KnownSymbol) symbolVal (Proxy :: Proxy ["hello", "world"])["hello","world"]QRQR Safe-Inferred)*/013Uservant-swagger p a -> String; zero _ = show (0 :: a)tmapEvery (Proxy :: Proxy [Show, Num]) zero (Proxy :: Proxy [Int, Float]) :: [String] ["0","0.0"]UVWVUW Safe-Inferred  UVWQR Safe-Inferred "/1%WZservant-swagger!Verify that every type used with q/ content type in a servant API has compatible r and b instances using s.NOTE: Z2 does not perform string pattern validation. See [.Z will produce one t specification for every type in the API. Each type only gets one test, even if it occurs multiple times in the API.data User = User { name :: String, age :: Maybe Int } deriving (Show, Generic, Typeable)newtype UserId = UserId String deriving (Show, Generic, Typeable, ToJSON, Arbitrary)instance ToJSON Userinstance ToSchema Userinstance ToSchema UserIdinstance Arbitrary User where arbitrary = User <$> arbitrary <*> arbitrarytype UserAPI = (Capture "user_id" UserId :> Get '[JSON] User) :<|> (ReqBody '[JSON] User :> Post '[JSON] UserId)hspec $ context "ToJSON matches ToSchema" $ validateEveryToJSON (Proxy :: Proxy UserAPI)ToJSON matches ToSchema... User...... UserId......Finished in ... seconds2 examples, 0 failuresFor the test to compile all body types should have the following instances:r and b$ are used to perform the validation;u( is used to name the test for each type;v$ is used to display value for which r does not satisfy b.w( is used to arbitrarily generate values.If any of the instances is missing, you'll get a descriptive type error:data Contact = Contact { fullname :: String, phone :: Integer } deriving (Show, Generic)instance ToJSON Contactinstance ToSchema Contact%type ContactAPI = Get '[JSON] Contact7hspec $ validateEveryToJSON (Proxy :: Proxy ContactAPI)...*...No instance for ...Arbitrary Contact...0... arising from a use of @validateEveryToJSON@...[servant-swagger!Verify that every type used with q/ content type in a servant API has compatible r and b instances using x.$For validation without patterns see Z.\servant-swaggerConstruct property tests for each type in a list. The name for each property is the name of the corresponding type.:{ hspec $ context "read . show == id" $ props( (Proxy :: Proxy [Eq, Show, Read])" (\x -> read (show x) === x)+ (Proxy :: Proxy [Bool, Int, String]):}read . show == id Bool...... Int...... [Char]......Finished in ... seconds3 examples, 0 failures]servant-swaggerPretty print validation errors together with actual JSON and Swagger Schema (using  encodePretty).import Data.Aeson import Data.Foldable (traverse_)data Person = Person { name :: String, phone :: Integer } deriving (Generic)instance ToJSON Person where toJSON p = object [ "name" .= name p ]instance ToSchema Person5let person = Person { name = "John", phone = 123456 }=traverse_ putStrLn $ prettyValidateWith validateToJSON person$Validation against the schema fails: * property "phone" is required, but not found in "{\"name\":\"John\"}" JSON value:{ "name": "John"}Swagger Schema:{ "properties": { "name": { "type": "string" }, "phone": { "type": "integer" } }, "required": [ "name", "phone" ], "type": "object"}FIXME: this belongs in Data.Swagger.Schema.Validation (in swagger2).^servant-swagger)Provide a counterexample if there is any.Zservant-swagger Servant API.[servant-swaggery checker.servant-swagger Servant API.\servant-swaggerA list of constraints.servant-swaggerProperty predicate.servant-swaggerA list of types.Z[\]^Z[\]^ BSD3)Nickolay Kudasov  experimental Safe-Inferred%Z[Z[ BSD3)Nickolay Kudasov  experimental Safe-Inferred&)Z[Z[ BSD3)Nickolay Kudasov  experimental Safe-Inferred&     !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsqtukvwkxykz{k|}q~qqkkkkkklqnnqq,servant-swagger-1.2.1-5eEn9VA93XVJWWw7w4jRwl Servant.Swagger.Internal.Orphans&Servant.Swagger.Internal.TypeLevel.APIServant.Swagger.Internal'Servant.Swagger.Internal.TypeLevel.TMap(Servant.Swagger.Internal.TypeLevel.EveryServant.Swagger.Internal.Testservant-swagger"Servant.Swagger.Internal.TypeLevelServant.Swagger.TestServant.SwaggerServant.Swagger.TypeLevel$fToSchemaSourceT$fToSchemaWithStatus BodyTypes' AddBodyType BodyTypesRemoveNubElemIsInOr AppendListMapSub AllIsElemIsSubAPI EndpointsListAllToResponseHeadertoAllResponseHeadersToResponseHeadertoResponseHeader AllAcceptallContentType SwaggerMethod swaggerMethod HasSwagger toSwagger subOperations mkEndpointmkEndpointNoContentmkEndpointWithSchemaRefmkEndpointNoContentVerbaddParamaddTag addConsumes markdownCodeaddDefaultResponse400combinePathItemcombineSwagger$fHasSwaggerTYPENamedRoutes$fHasSwaggerTYPE:>$fHasSwaggerTYPE:>0$fHasSwaggerTYPE:>1$fHasSwaggerTYPE:>2$fHasSwaggerTYPE:>3$fHasSwaggerTYPE:>4$fHasSwaggerTYPE:>5$fHasSwaggerTYPE:>6$fHasSwaggerTYPE:>7$fHasSwaggerTYPE:>8$fHasSwaggerTYPE:>9 $fHasSwaggerTYPEWithNamedContext$fHasSwaggerTYPE:>10$fHasSwaggerTYPE:>11$fHasSwaggerTYPE:>12$fHasSwaggerTYPE:>13$fHasSwaggerTYPE:>14$fHasSwaggerTYPE:<|>$fHasSwaggerTYPEUVerb$fHasSwaggerTYPEEmptyAPI$fHasSwaggerTYPERaw$fHasSwaggerTYPENoContentVerb$fHasSwaggerTYPEStream$fSwaggerMethodStdMethodPATCH$fSwaggerMethodStdMethodHEAD$fSwaggerMethodStdMethodOPTIONS$fSwaggerMethodStdMethodDELETE$fSwaggerMethodStdMethodPOST$fSwaggerMethodStdMethodPUT$fSwaggerMethodStdMethodGET$fAllAcceptList:$fAllAcceptList[]$fHasSwaggerTYPE:>15$fHasSwaggerTYPEVerb$fHasSwaggerTYPEVerb0$fHasSwaggerTYPEUVerb0$fHasSwaggerTYPEUVerb1$fToResponseHeaderTYPEHeader'$fAllToResponseHeaderTYPEHList$fAllToResponseHeaderList:$fAllToResponseHeaderList[]$fHasSwaggerTYPEVerb1$fHasSwaggerTYPEVerb2TMaptmap $fTMapaq: $fTMapkq[]EveryEveryTF tmapEvery $fEvery:x $fEvery[]xvalidateEveryToJSON%validateEveryToJSONWithPatternCheckerpropsprettyValidateWithmaybeCounterExample$servant-0.20.2-Gi9sNeCszk4lB7Qo1IEZKServant.API.ContentTypes NoContentbase Data.Foldableelem%swagger2-2.8.9-A5XOlLlNhyx6h2Wt1lixPj!Data.Swagger.Internal.ParamSchema ToParamSchemaData.Swagger.Internal.SchemaToSchemaServant.API.CaptureCaptureServant.API.QueryParam QueryParamServant.API.ResponseHeadersResponseHeaderServant.API.ReqBodyReqBodyData.Swagger.Operation operationsOfData.Swagger.InternalSwaggerData.Swagger.Lens definitionsServant.API.WithResource WithResourceServant.API.WithNamedContextWithNamedContext(http-types-0.12.4-3cKid6j5VJVJ0dTLPi8qAtNetwork.HTTP.Types.Version HttpVersionServant.API.FragmentFragmentServant.API.RemoteHost RemoteHostServant.API.IsSecureIsSecure$vault-0.3.1.5-Jo7sODJAx1p9tDtksZcWAQData.Vault.LazyVaultJSON$aeson-2.2.3.0-G9Z2Jit3h8hFb5zDbTBNRhData.Aeson.Types.ToJSONToJSON'Data.Swagger.Internal.Schema.ValidationvalidateToJSON#hspec-2.11.9-LtIjKPa9CO28qYLK0ROwYMTest.Hspec.QuickCheckpropData.Typeable.InternalTypeableGHC.ShowShow*QuickCheck-2.15.0.1-JyXbAFb7UipIPAKrEhXkquTest.QuickCheck.Arbitrary Arbitrary validateToJSONWithPatternCheckerPattern