Skip to content

Commit

Permalink
Merge pull request #189 from felixonmars/generics-sop-0.5
Browse files Browse the repository at this point in the history
Fix compatibility with generics-sop 0.5
  • Loading branch information
phadej committed May 17, 2019
2 parents 6448fcf + 96420ab commit cf4b03b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/Data/Swagger/Internal/AesonUtils.hs
Expand Up @@ -144,7 +144,11 @@ sopSwaggerGenericToJSON'
-> DatatypeInfo '[xs]
-> POP Maybe '[xs]
-> [Pair]
#if MIN_VERSION_generics_sop(0,5,0)
sopSwaggerGenericToJSON' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
#else
sopSwaggerGenericToJSON' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) =
#endif
sopSwaggerGenericToJSON'' opts fields fieldsInfo defs
sopSwaggerGenericToJSON' _ _ _ _ = error "sopSwaggerGenericToJSON: unsupported type"

Expand Down Expand Up @@ -220,7 +224,11 @@ sopSwaggerGenericParseJSON'
-> DatatypeInfo '[xs]
-> POP Maybe '[xs]
-> Parser (SOP I '[xs])
#if MIN_VERSION_generics_sop(0,5,0)
sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
#else
sopSwaggerGenericParseJSON' opts obj (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) =
#endif
SOP . Z <$> sopSwaggerGenericParseJSON'' opts obj fieldsInfo defs
sopSwaggerGenericParseJSON' _ _ _ _ = error "sopSwaggerGenericParseJSON: unsupported type"

Expand Down Expand Up @@ -292,7 +300,11 @@ sopSwaggerGenericToEncoding'
-> DatatypeInfo '[xs]
-> POP Maybe '[xs]
-> Series
#if MIN_VERSION_generics_sop(0,5,0)
sopSwaggerGenericToEncoding' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil) _) (POP (defs :* Nil)) =
#else
sopSwaggerGenericToEncoding' opts (SOP (Z fields)) (ADT _ _ (Record _ fieldsInfo :* Nil)) (POP (defs :* Nil)) =
#endif
sopSwaggerGenericToEncoding'' opts fields fieldsInfo defs
sopSwaggerGenericToEncoding' _ _ _ _ = error "sopSwaggerGenericToEncoding: unsupported type"

Expand Down
2 changes: 1 addition & 1 deletion swagger2.cabal
Expand Up @@ -77,7 +77,7 @@ library
, aeson >=1.4.2.0 && <1.5
-- cookie 0.4.3 is needed by GHC 7.8 due to time>=1.4 constraint
, cookie >=0.4.3 && <0.5
, generics-sop >=0.3.2.0 && <0.5
, generics-sop >=0.3.2.0 && <0.6
, hashable >=1.2.7.0 && <1.3
, http-media >=0.7.1.2 && <0.9
, insert-ordered-containers >=0.2.1.0 && <0.3
Expand Down

0 comments on commit cf4b03b

Please sign in to comment.