git.iko.soy/typeable/openapi3
on 1881018 help sign in
8 files changed+15−154
since splitsnapshots
unifiedsplit
.github/workflows/haskell-ci.yml+8−8 CHANGELOG.md−5 cabal.haskell-ci−4 openapi3.cabal+3−3 src/Data/OpenApi/Internal/Schema.hs+3−6 stack.yaml+1−1 test/Data/OpenApi/CommonTestTypes.hs−123 test/Data/OpenApi/SchemaSpec.hs−4
.github/workflows/haskell-ci.yml+8−8
@@ -8,9 +8,9 @@
88#
99# For more information, see https://github.com/haskell-CI/haskell-ci
1010#
11−# version: 0.14.3
11+# version: 0.14
1212#
13−# REGENDATA ("0.14.3",["github","cabal.project"])
13+# REGENDATA ("0.14",["github","cabal.project"])
1414#
1515name: Haskell-CI
1616on:
@@ -32,9 +32,9 @@ jobs:
3232 strategy:
3333 matrix:
3434 include:
35− - compiler: ghc-9.2.2
35+ - compiler: ghc-9.2.1
3636 compilerKind: ghc
37− compilerVersion: 9.2.2
37+ compilerVersion: 9.2.1
3838 setup-method: ghcup
3939 allow-failure: true
4040 - compiler: ghc-9.0.2
@@ -70,7 +70,7 @@ jobs:
7070 apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
7171 if [ "${{ matrix.setup-method }}" = ghcup ]; then
7272 mkdir -p "$HOME/.ghcup/bin"
73− curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup"
73+ curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
7474 chmod a+x "$HOME/.ghcup/bin/ghcup"
7575 "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
7676 "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
@@ -79,7 +79,7 @@ jobs:
7979 apt-get update
8080 apt-get install -y "$HCNAME"
8181 mkdir -p "$HOME/.ghcup/bin"
82− curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup"
82+ curl -sL https://downloads.haskell.org/ghcup/0.1.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
8383 chmod a+x "$HOME/.ghcup/bin/ghcup"
8484 "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
8585 fi
@@ -239,5 +239,5 @@ jobs:
239239 $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson >=2.0' all
240240 - name: constraint set aeson-1
241241 run: |
242− if [ $((HCNUMVER < 90200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson <2.0' --dependencies-only -j2 all ; fi
243− if [ $((HCNUMVER < 90200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson <2.0' all ; fi
242+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson <2.0' --dependencies-only -j2 all
243+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson <2.0' all
CHANGELOG.md−5
@@ -1,11 +1,6 @@
11Unreleased
22----------
33
4−3.2.2
5−-----
6−
7−- Fix bug with infinite recursion in GToSchema [#37](https://github.com/biocad/openapi3/pull/37).
8−
943.2.1
105-----
116
cabal.haskell-ci−4
@@ -1,11 +1,7 @@
11branches: master
22
3−distribution: focal
4−allow-failures: >=9.2
5−
63constraint-set aeson-1
74 constraints: aeson <2.0
8− ghc: <9.2
95
106constraint-set aeson-2
117 constraints: aeson >=2.0
openapi3.cabal+3−3
@@ -1,6 +1,6 @@
11cabal-version: >=1.10
22name: openapi3
3−version: 3.2.2
3+version: 3.2.1
44
55synopsis: OpenAPI 3.0 data model
66category: Web, Swagger, OpenApi
@@ -28,7 +28,7 @@ tested-with:
2828 || ==8.8.4
2929 || ==8.10.7
3030 || ==9.0.2
31− || ==9.2.2
31+ || ==9.2.1
3232
3333custom-setup
3434 setup-depends:
@@ -70,7 +70,7 @@ library
7070
7171 build-depends:
7272 mtl >=2.2.2 && <2.3
73− , text >=1.2.3.1 && <2.1
73+ , text >=1.2.3.1 && <1.3
7474
7575 -- other dependencies
7676 build-depends:
src/Data/OpenApi/Internal/Schema.hs+3−6
@@ -945,13 +945,10 @@ instance (Selector s, GToSchema f, GToSchema (S1 s f)) => GToSchema (C1 c (S1 s
945945 case schema ^. items of
946946 Just (OpenApiItemsArray [_]) -> fieldSchema
947947 _ -> do
948− -- We have to run recordSchema instead of just using its defs,
949− -- since those can be recursive and will lead to infinite loop,
950− -- see https://github.com/biocad/openapi3/pull/37
951− NamedSchema _ schema' <- recordSchema
952− return (unnamed schema')
948+ declare defs
949+ return (unnamed schema)
953950 where
954− (_, NamedSchema _ schema) = runDeclare recordSchema mempty
951+ (defs, NamedSchema _ schema) = runDeclare recordSchema mempty
955952 recordSchema = gdeclareNamedSchema opts (Proxy :: Proxy (S1 s f)) s
956953 fieldSchema = gdeclareNamedSchema opts (Proxy :: Proxy f) s
957954
stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: lts-16.31
1+resolver: lts-16.8
22packages:
33- '.'
44extra-deps:
test/Data/OpenApi/CommonTestTypes.hs−123
@@ -863,129 +863,6 @@ singleMaybeFieldSchemaJSON = [aesonQQ|
863863}
864864|]
865865
866−-- ========================================================================
867−-- Natural Language (single field data with recursive fields)
868−-- ========================================================================
869−
870−data Predicate
871− = PredicateNoun Noun
872− | PredicateOmitted Omitted
873− deriving (Eq, Ord, Read, Show, Generic)
874−instance ToJSON Predicate
875−instance ToSchema Predicate
876−
877−data Noun
878− = Noun
879− { nounSurf :: LangWord
880− , nounModify :: [Modifier]
881− }
882− deriving (Eq, Ord, Read, Show, Generic)
883−instance ToJSON Noun
884−instance ToSchema Noun
885−
886−data LangWord
887− = LangWord
888− { langWordSurf :: String
889− , langWordBase :: String
890− }
891− deriving (Eq, Ord, Read, Show, Generic)
892−instance ToJSON LangWord
893−instance ToSchema LangWord
894−
895−data Modifier
896− = ModifierNoun Noun
897− | ModifierOmitted Omitted
898− deriving (Eq, Ord, Read, Show, Generic)
899−instance ToJSON Modifier
900−instance ToSchema Modifier
901−
902−newtype Omitted
903− = Omitted
904− { omittedModify :: [Modifier]
905− }
906− deriving (Eq, Ord, Read, Show, Generic)
907−instance ToJSON Omitted
908−instance ToSchema Omitted
909−
910−predicateSchemaDeclareJSON :: Value
911−predicateSchemaDeclareJSON = [aesonQQ|
912−[
913− {
914− "Predicate": {
915− "oneOf": [
916− {
917− "properties": {
918− "contents": { "$ref": "#/components/schemas/Noun" },
919− "tag": { "enum": ["PredicateNoun"], "type": "string" }
920− },
921− "required": ["tag", "contents"],
922− "type": "object"
923− },
924− {
925− "properties": {
926− "contents": { "$ref": "#/components/schemas/Omitted" },
927− "tag": { "enum": ["PredicateOmitted"], "type": "string" }
928− },
929− "required": ["tag", "contents"],
930− "type": "object"
931− }
932− ],
933− "type": "object"
934− },
935− "Noun": {
936− "properties": {
937− "nounModify": {
938− "items": { "$ref": "#/components/schemas/Modifier" },
939− "type": "array"
940− },
941− "nounSurf": { "$ref": "#/components/schemas/LangWord" }
942− },
943− "required": ["nounSurf", "nounModify"],
944− "type": "object"
945− },
946− "LangWord": {
947− "properties": {
948− "langWordBase": { "type": "string" },
949− "langWordSurf": { "type": "string" }
950− },
951− "required": ["langWordSurf", "langWordBase"],
952− "type": "object"
953− },
954− "Modifier": {
955− "oneOf": [
956− {
957− "properties": {
958− "contents": { "$ref": "#/components/schemas/Noun" },
959− "tag": { "enum": ["ModifierNoun"], "type": "string" }
960− },
961− "required": ["tag", "contents"],
962− "type": "object"
963− },
964− {
965− "properties": {
966− "contents": { "$ref": "#/components/schemas/Omitted" },
967− "tag": { "enum": ["ModifierOmitted"], "type": "string" }
968− },
969− "required": ["tag", "contents"],
970− "type": "object"
971− }
972− ],
973− "type": "object"
974− },
975− "Omitted": {
976− "properties": {
977− "omittedModify": {
978− "items": { "$ref": "#/components/schemas/Modifier" },
979− "type": "array"
980− }
981− },
982− "required": ["omittedModify"],
983− "type": "object"
984− }
985− },
986− { "$ref": "#/components/schemas/Predicate" }
987−]
988−|]
989866
990867-- ========================================================================
991868-- TimeOfDay
test/Data/OpenApi/SchemaSpec.hs−4
@@ -59,9 +59,6 @@ checkInlinedRecSchema proxy js = inlineNonRecursiveSchemas defs s <=> js
5959 where
6060 (defs, s) = runDeclare (declareSchema proxy) mempty
6161
62−checkToSchemaDeclare :: (HasCallStack, ToSchema a) => Proxy a -> Value -> Spec
63−checkToSchemaDeclare proxy js = runDeclare (declareSchemaRef proxy) mempty <=> js
64−
6562spec :: Spec
6663spec = do
6764 describe "Generic ToSchema" $ do
@@ -81,7 +78,6 @@ spec = do
8178 context "UserId (non-record newtype)" $ checkToSchema (Proxy :: Proxy UserId) userIdSchemaJSON
8279 context "Player (unary record)" $ checkToSchema (Proxy :: Proxy Player) playerSchemaJSON
8380 context "SingleMaybeField (unary record with Maybe)" $ checkToSchema (Proxy :: Proxy SingleMaybeField) singleMaybeFieldSchemaJSON
84− context "Natural Language (single field data with recursive fields)" $ checkToSchemaDeclare (Proxy :: Proxy Predicate) predicateSchemaDeclareJSON
8581 context "Players (inlining schema)" $ checkToSchema (Proxy :: Proxy Players) playersSchemaJSON
8682 context "MyRoseTree (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
8783 context "MyRoseTree' (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree') myRoseTreeSchemaJSON'