1{-# LANGUAGE ScopedTypeVariables #-}
5import Database.V5.Bloodhound
8import Data.Aeson.Types (parseEither)
9import qualified Data.ByteString.Lazy.Char8 as BL8
10import qualified Data.List as L
11import qualified Data.List.NonEmpty as NE
15import Test.Hspec.QuickCheck
30propJSON _ = prop testName $ \(a :: a) ->
31 let jsonStr = "via " <> BL8.unpack (encode a)
32 in counterexample jsonStr (parseEither parseJSON (toJSON a)
34 where testName = show ty <> " FromJSON/ToJSON roundtrips"
35 ty = typeOf (undefined :: a)
37propApproxJSON :: forall a
46propApproxJSON _ = prop testName $ \(a :: a) ->
47 let jsonStr = "via " <> BL8.unpack (encode a)
48 in counterexample jsonStr (parseEither parseJSON (toJSON a)
50 where testName = show ty <> " FromJSON/ToJSON roundtrips"
51 ty = typeOf (undefined :: a)
55 describe "Exact isomorphism JSON instances" $ do
56 propJSON (Proxy :: Proxy Version)
57 propJSON (Proxy :: Proxy IndexName)
58 propJSON (Proxy :: Proxy MappingName)
59 propJSON (Proxy :: Proxy DocId)
60 propJSON (Proxy :: Proxy IndexAliasRouting)
61 propJSON (Proxy :: Proxy RoutingValue)
62 propJSON (Proxy :: Proxy ShardCount)
63 propJSON (Proxy :: Proxy ReplicaCount)
64 propJSON (Proxy :: Proxy TemplateName)
65 propJSON (Proxy :: Proxy TemplatePattern)
66 propJSON (Proxy :: Proxy QueryString)
67 propJSON (Proxy :: Proxy FieldName)
68 propJSON (Proxy :: Proxy Script)
69 propJSON (Proxy :: Proxy ScriptLanguage)
70 propJSON (Proxy :: Proxy ScriptInline)
71 propJSON (Proxy :: Proxy ScriptId)
72 propJSON (Proxy :: Proxy ScriptParams)
73 propJSON (Proxy :: Proxy CacheName)
74 propJSON (Proxy :: Proxy CacheKey)
75 propJSON (Proxy :: Proxy Existence)
76 propJSON (Proxy :: Proxy CutoffFrequency)
77 propJSON (Proxy :: Proxy Analyzer)
78 propJSON (Proxy :: Proxy MaxExpansions)
79 propJSON (Proxy :: Proxy Lenient)
80 propJSON (Proxy :: Proxy Tiebreaker)
81 propJSON (Proxy :: Proxy Boost)
82 propJSON (Proxy :: Proxy BoostTerms)
83 propJSON (Proxy :: Proxy MinimumMatch)
84 propJSON (Proxy :: Proxy DisableCoord)
85 propJSON (Proxy :: Proxy IgnoreTermFrequency)
86 propJSON (Proxy :: Proxy MinimumTermFrequency)
87 propJSON (Proxy :: Proxy MaxQueryTerms)
88 propJSON (Proxy :: Proxy Fuzziness)
89 propJSON (Proxy :: Proxy PrefixLength)
90 propJSON (Proxy :: Proxy TypeName)
91 propJSON (Proxy :: Proxy PercentMatch)
92 propJSON (Proxy :: Proxy StopWord)
93 propJSON (Proxy :: Proxy QueryPath)
94 propJSON (Proxy :: Proxy AllowLeadingWildcard)
95 propJSON (Proxy :: Proxy LowercaseExpanded)
96 propJSON (Proxy :: Proxy EnablePositionIncrements)
97 propJSON (Proxy :: Proxy AnalyzeWildcard)
98 propJSON (Proxy :: Proxy GeneratePhraseQueries)
99 propJSON (Proxy :: Proxy Locale)
100 propJSON (Proxy :: Proxy MaxWordLength)
101 propJSON (Proxy :: Proxy MinWordLength)
102 propJSON (Proxy :: Proxy PhraseSlop)
103 propJSON (Proxy :: Proxy MinDocFrequency)
104 propJSON (Proxy :: Proxy MaxDocFrequency)
105 propJSON (Proxy :: Proxy Filter)
106 propJSON (Proxy :: Proxy Query)
107 propJSON (Proxy :: Proxy SimpleQueryStringQuery)
108 propJSON (Proxy :: Proxy FieldOrFields)
109 propJSON (Proxy :: Proxy SimpleQueryFlag)
110 propJSON (Proxy :: Proxy RegexpQuery)
111 propJSON (Proxy :: Proxy QueryStringQuery)
112 propJSON (Proxy :: Proxy RangeQuery)
113 propJSON (Proxy :: Proxy PrefixQuery)
114 propJSON (Proxy :: Proxy NestedQuery)
115 propJSON (Proxy :: Proxy MoreLikeThisFieldQuery)
116 propJSON (Proxy :: Proxy MoreLikeThisQuery)
117 propJSON (Proxy :: Proxy IndicesQuery)
118 propJSON (Proxy :: Proxy HasParentQuery)
119 propJSON (Proxy :: Proxy HasChildQuery)
120 propJSON (Proxy :: Proxy FuzzyQuery)
121 propJSON (Proxy :: Proxy FuzzyLikeFieldQuery)
122 propJSON (Proxy :: Proxy FuzzyLikeThisQuery)
123 propJSON (Proxy :: Proxy FunctionScoreQuery)
124 propJSON (Proxy :: Proxy BoostMode)
125 propJSON (Proxy :: Proxy ScoreMode)
126 propJSON (Proxy :: Proxy ComponentFunctionScoreFunction)
127 propJSON (Proxy :: Proxy FieldValueFactor)
128 propJSON (Proxy :: Proxy FactorModifier)
129 propJSON (Proxy :: Proxy DisMaxQuery)
130 propJSON (Proxy :: Proxy CommonTermsQuery)
131 propJSON (Proxy :: Proxy CommonMinimumMatch)
132 propJSON (Proxy :: Proxy BoostingQuery)
133 propJSON (Proxy :: Proxy BoolQuery)
134 propJSON (Proxy :: Proxy MatchQuery)
135 propJSON (Proxy :: Proxy MultiMatchQueryType)
136 propJSON (Proxy :: Proxy BooleanOperator)
137 propJSON (Proxy :: Proxy ZeroTermsQuery)
138 propJSON (Proxy :: Proxy MatchQueryType)
139 propJSON (Proxy :: Proxy AliasRouting)
140 propJSON (Proxy :: Proxy IndexAliasCreate)
141 propJSON (Proxy :: Proxy SearchAliasRouting)
142 propJSON (Proxy :: Proxy ScoreType)
143 propJSON (Proxy :: Proxy Distance)
144 propJSON (Proxy :: Proxy DistanceUnit)
145 propJSON (Proxy :: Proxy DistanceType)
146 propJSON (Proxy :: Proxy OptimizeBbox)
147 propJSON (Proxy :: Proxy GeoBoundingBoxConstraint)
148 propJSON (Proxy :: Proxy GeoFilterType)
149 propJSON (Proxy :: Proxy GeoBoundingBox)
150 propJSON (Proxy :: Proxy LatLon)
151 propJSON (Proxy :: Proxy RangeExecution)
152 prop "RegexpFlags FromJSON/ToJSON roundtrips, removing dups " $ \rfs ->
153 let expected = case rfs of
154 SomeRegexpFlags fs -> SomeRegexpFlags (NE.fromList (L.nub (NE.toList fs)))
156 in parseEither parseJSON (toJSON rfs) === Right expected
157 propJSON (Proxy :: Proxy BoolMatch)
158 propJSON (Proxy :: Proxy Term)
159 propJSON (Proxy :: Proxy MultiMatchQuery)
160 propJSON (Proxy :: Proxy IndexSettings)
161 propJSON (Proxy :: Proxy CompoundFormat)
162 propJSON (Proxy :: Proxy TemplateQueryInline)
163 propJSON (Proxy :: Proxy Suggest)
164 propJSON (Proxy :: Proxy DirectGenerators)
165 propJSON (Proxy :: Proxy DirectGeneratorSuggestModeTypes)
167 describe "Approximate isomorphism JSON instances" $ do
168 propApproxJSON (Proxy :: Proxy UpdatableIndexSetting')
169 propApproxJSON (Proxy :: Proxy ReplicaCount)
170 propApproxJSON (Proxy :: Proxy ReplicaBounds)
171 propApproxJSON (Proxy :: Proxy Bytes)
172 propApproxJSON (Proxy :: Proxy AllocationPolicy)
173 propApproxJSON (Proxy :: Proxy InitialShardCount)
174 propApproxJSON (Proxy :: Proxy FSType)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list