git.iko.soy/typeable/openapi3
on 5eac87f help sign in
.github/workflows/haskell-ci.yml+29−82
since splitsnapshots
unifiedsplit
@@ -8,9 +8,9 @@
8#
8#
9# For more information, see https://github.com/haskell-CI/haskell-ci
9# For more information, see https://github.com/haskell-CI/haskell-ci
10#
10#
11−# version: 0.14.3
11+# version: 0.12.1
12#
12#
13−# REGENDATA ("0.14.3",["github","cabal.project"])
13+# REGENDATA ("0.12.1",["github","cabal.project"])
14#
14#
15name: Haskell-CI
15name: Haskell-CI
16on:
16on:
@@ -24,101 +24,55 @@ jobs:
24 linux:
24 linux:
25 name: Haskell-CI - Linux - ${{ matrix.compiler }}
25 name: Haskell-CI - Linux - ${{ matrix.compiler }}
26 runs-on: ubuntu-18.04
26 runs-on: ubuntu-18.04
27− timeout-minutes:
28− 60
29 container:
27 container:
30− image: buildpack-deps:focal
28+ image: buildpack-deps:bionic
31 continue-on-error: ${{ matrix.allow-failure }}
29 continue-on-error: ${{ matrix.allow-failure }}
32 strategy:
30 strategy:
33 matrix:
31 matrix:
34 include:
32 include:
35− - compiler: ghc-9.2.2
33+ - compiler: ghc-9.0.1
36− compilerKind: ghc
37− compilerVersion: 9.2.2
38− setup-method: ghcup
39 allow-failure: true
34 allow-failure: true
40− - compiler: ghc-9.0.2
35+ - compiler: ghc-8.10.4
41− compilerKind: ghc
42− compilerVersion: 9.0.2
43− setup-method: ghcup
44− allow-failure: false
45− - compiler: ghc-8.10.7
46− compilerKind: ghc
47− compilerVersion: 8.10.7
48− setup-method: ghcup
49 allow-failure: false
36 allow-failure: false
50 - compiler: ghc-8.8.4
37 - compiler: ghc-8.8.4
51− compilerKind: ghc
52− compilerVersion: 8.8.4
53− setup-method: hvr-ppa
54 allow-failure: false
38 allow-failure: false
55 - compiler: ghc-8.6.5
39 - compiler: ghc-8.6.5
56− compilerKind: ghc
57− compilerVersion: 8.6.5
58− setup-method: hvr-ppa
59 allow-failure: false
40 allow-failure: false
60 - compiler: ghc-8.4.4
41 - compiler: ghc-8.4.4
61− compilerKind: ghc
62− compilerVersion: 8.4.4
63− setup-method: hvr-ppa
64 allow-failure: false
42 allow-failure: false
65 fail-fast: false
43 fail-fast: false
66 steps:
44 steps:
67 - name: apt
45 - name: apt
68 run: |
46 run: |
69 apt-get update
47 apt-get update
70− apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
48+ apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common
71− if [ "${{ matrix.setup-method }}" = ghcup ]; then
72− 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"
74− chmod a+x "$HOME/.ghcup/bin/ghcup"
75− "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
76− "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
77− else
78− apt-add-repository -y 'ppa:hvr/ghc'
49+ apt-add-repository -y 'ppa:hvr/ghc'
79− apt-get update
50+ apt-get update
80− apt-get install -y "$HCNAME"
51+ apt-get install -y $CC cabal-install-3.4
81− 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"
83− chmod a+x "$HOME/.ghcup/bin/ghcup"
84− "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
85− fi
86 env:
52 env:
87− HCKIND: ${{ matrix.compilerKind }}
88− HCNAME: ${{ matrix.compiler }}
53+ CC: ${{ matrix.compiler }}
89− HCVER: ${{ matrix.compilerVersion }}
90 - name: Set PATH and environment variables
54 - name: Set PATH and environment variables
91 run: |
55 run: |
92 echo "$HOME/.cabal/bin" >> $GITHUB_PATH
56 echo "$HOME/.cabal/bin" >> $GITHUB_PATH
93− echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
57+ echo "LANG=C.UTF-8" >> $GITHUB_ENV
94− echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
58+ echo "CABAL_DIR=$HOME/.cabal" >> $GITHUB_ENV
95− echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
59+ echo "CABAL_CONFIG=$HOME/.cabal/config" >> $GITHUB_ENV
96− HCDIR=/opt/$HCKIND/$HCVER
60+ HCDIR=$(echo "/opt/$CC" | sed 's/-/\//')
97− if [ "${{ matrix.setup-method }}" = ghcup ]; then
61+ HCNAME=ghc
98− HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
62+ HC=$HCDIR/bin/$HCNAME
99− echo "HC=$HC" >> "$GITHUB_ENV"
63+ echo "HC=$HC" >> $GITHUB_ENV
100− echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
64+ echo "HCPKG=$HCDIR/bin/$HCNAME-pkg" >> $GITHUB_ENV
101− echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
65+ echo "HADDOCK=$HCDIR/bin/haddock" >> $GITHUB_ENV
102− echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
103− else
104− HC=$HCDIR/bin/$HCKIND
105− echo "HC=$HC" >> "$GITHUB_ENV"
106− echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
107− echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
108− echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
66+ echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> $GITHUB_ENV
109− fi
110−
111 HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
67 HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
112− echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
68+ echo "HCNUMVER=$HCNUMVER" >> $GITHUB_ENV
113− echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
69+ echo "ARG_TESTS=--enable-tests" >> $GITHUB_ENV
114− echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
70+ echo "ARG_BENCH=--enable-benchmarks" >> $GITHUB_ENV
115− echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
71+ echo "HEADHACKAGE=false" >> $GITHUB_ENV
116− echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
72+ echo "ARG_COMPILER=--$HCNAME --with-compiler=$HC" >> $GITHUB_ENV
117− echo "GHCJSARITH=0" >> "$GITHUB_ENV"
73+ echo "GHCJSARITH=0" >> $GITHUB_ENV
118 env:
74 env:
119− HCKIND: ${{ matrix.compilerKind }}
120− HCNAME: ${{ matrix.compiler }}
75+ CC: ${{ matrix.compiler }}
121− HCVER: ${{ matrix.compilerVersion }}
122 - name: env
76 - name: env
123 run: |
77 run: |
124 env
78 env
@@ -141,10 +95,6 @@ jobs:
141 repository hackage.haskell.org
95 repository hackage.haskell.org
142 url: http://hackage.haskell.org/
96 url: http://hackage.haskell.org/
143 EOF
97 EOF
144− cat >> $CABAL_CONFIG <<EOF
145− program-default-options
146− ghc-options: $GHCJOBS +RTS -M3G -RTS
147− EOF
148 cat $CABAL_CONFIG
98 cat $CABAL_CONFIG
149 - name: versions
99 - name: versions
150 run: |
100 run: |
@@ -183,8 +133,7 @@ jobs:
183 - name: generate cabal.project
133 - name: generate cabal.project
184 run: |
134 run: |
185 PKGDIR_openapi3="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/openapi3-[0-9.]*')"
135 PKGDIR_openapi3="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/openapi3-[0-9.]*')"
186− echo "PKGDIR_openapi3=${PKGDIR_openapi3}" >> "$GITHUB_ENV"
136+ echo "PKGDIR_openapi3=${PKGDIR_openapi3}" >> $GITHUB_ENV
187− rm -f cabal.project cabal.project.local
188 touch cabal.project
137 touch cabal.project
189 touch cabal.project.local
138 touch cabal.project.local
190 echo "packages: ${PKGDIR_openapi3}" >> cabal.project
139 echo "packages: ${PKGDIR_openapi3}" >> cabal.project
@@ -235,9 +184,7 @@ jobs:
235 rm -f cabal.project.local
184 rm -f cabal.project.local
236 - name: constraint set aeson-2
185 - name: constraint set aeson-2
237 run: |
186 run: |
238− $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson >=2.0' --dependencies-only -j2 all
239 $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson >=2.0' all
187 $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson >=2.0' all
240 - name: constraint set aeson-1
188 - name: constraint set aeson-1
241 run: |
189 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
190+ $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson <2.0' all
243− if [ $((HCNUMVER < 90200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='aeson <2.0' all ; fi
CHANGELOG.md−14
@@ -1,20 +1,6 @@
1Unreleased
1Unreleased
2----------
2----------
3
3
4−3.2.2
5−-----
6−
7−- Fix bug with infinite recursion in GToSchema [#37](https://github.com/biocad/openapi3/pull/37).
8−
9−3.2.1
10−-----
11−
12−- Support aeson-2.0.3.
13−- Support GHC-9.2 (doctests still fail).
14−
15−3.2.0
16−-----
17−
18- Support aeson-2 [#34](https://github.com/biocad/openapi3/pull/34).
4- Support aeson-2 [#34](https://github.com/biocad/openapi3/pull/34).
19- Use `SecurityDefinitions` type for `_componentsSecuritySchemes`
5- Use `SecurityDefinitions` type for `_componentsSecuritySchemes`
20 [#32](https://github.com/biocad/openapi3/pull/32).
6 [#32](https://github.com/biocad/openapi3/pull/32).
cabal.haskell-ci−4
@@ -1,11 +1,7 @@
1branches: master
1branches: master
2
2
3−distribution: focal
4−allow-failures: >=9.2
5−
6constraint-set aeson-1
3constraint-set aeson-1
7 constraints: aeson <2.0
4 constraints: aeson <2.0
8− ghc: <9.2
9
5
10constraint-set aeson-2
6constraint-set aeson-2
11 constraints: aeson >=2.0
7 constraints: aeson >=2.0
openapi3.cabal+8−9
@@ -1,6 +1,6 @@
1cabal-version: >=1.10
1cabal-version: >=1.10
2name: openapi3
2name: openapi3
3−version: 3.2.2
3+version: 3.2.0
4
4
5synopsis: OpenAPI 3.0 data model
5synopsis: OpenAPI 3.0 data model
6category: Web, Swagger, OpenApi
6category: Web, Swagger, OpenApi
@@ -26,9 +26,8 @@ tested-with:
26 GHC ==8.4.4
26 GHC ==8.4.4
27 || ==8.6.5
27 || ==8.6.5
28 || ==8.8.4
28 || ==8.8.4
29− || ==8.10.7
29+ || ==8.10.4
30− || ==9.0.2
30+ || ==9.0.1
31− || ==9.2.2
32
31
33custom-setup
32custom-setup
34 setup-depends:
33 setup-depends:
@@ -61,16 +60,16 @@ library
61
60
62 -- GHC boot libraries
61 -- GHC boot libraries
63 build-depends:
62 build-depends:
64− base >=4.11.1.0 && <4.17
63+ base >=4.11.1.0 && <4.16
65− , bytestring >=0.10.8.2 && <0.12
64+ , bytestring >=0.10.8.2 && <0.11
66 , containers >=0.5.11.0 && <0.7
65 , containers >=0.5.11.0 && <0.7
67− , template-haskell >=2.13.0.0 && <2.19
66+ , template-haskell >=2.13.0.0 && <2.18
68− , time >=1.8.0.2 && <1.14
67+ , time >=1.8.0.2 && <1.10
69 , transformers >=0.5.5.0 && <0.6
68 , transformers >=0.5.5.0 && <0.6
70
69
71 build-depends:
70 build-depends:
72 mtl >=2.2.2 && <2.3
71 mtl >=2.2.2 && <2.3
73− , text >=1.2.3.1 && <2.1
72+ , text >=1.2.3.1 && <1.3
74
73
75 -- other dependencies
74 -- other dependencies
76 build-depends:
75 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
945 case schema ^. items of
945 case schema ^. items of
946 Just (OpenApiItemsArray [_]) -> fieldSchema
946 Just (OpenApiItemsArray [_]) -> fieldSchema
947 _ -> do
947 _ -> do
948− -- We have to run recordSchema instead of just using its defs,
948+ declare 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')
949+ return (unnamed schema)
953 where
950 where
954− (_, NamedSchema _ schema) = runDeclare recordSchema mempty
951+ (defs, NamedSchema _ schema) = runDeclare recordSchema mempty
955 recordSchema = gdeclareNamedSchema opts (Proxy :: Proxy (S1 s f)) s
952 recordSchema = gdeclareNamedSchema opts (Proxy :: Proxy (S1 s f)) s
956 fieldSchema = gdeclareNamedSchema opts (Proxy :: Proxy f) s
953 fieldSchema = gdeclareNamedSchema opts (Proxy :: Proxy f) s
957
954
stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: lts-16.31
1+resolver: lts-16.8
2packages:
2packages:
3- '.'
3- '.'
4extra-deps:
4extra-deps:
test/Data/OpenApi/CommonTestTypes.hs−123
@@ -863,129 +863,6 @@ singleMaybeFieldSchemaJSON = [aesonQQ|
863}
863}
864|]
864|]
865
865
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−|]
989
866
990-- ========================================================================
867-- ========================================================================
991-- TimeOfDay
868-- TimeOfDay
test/Data/OpenApi/Schema/ValidationSpec.hs−3
@@ -301,8 +301,6 @@ instance Eq ZonedTime where
301-- Arbitrary instance for Data.Aeson.Value
301-- Arbitrary instance for Data.Aeson.Value
302-- ========================================================================
302-- ========================================================================
303
303
304−-- These instances were introduces in aeson upstream in 2.0.3
305−#if !MIN_VERSION_aeson(2,0,3)
306instance Arbitrary Value where
304instance Arbitrary Value where
307 -- Weights are almost random
305 -- Weights are almost random
308 -- Uniform oneof tends not to build complex objects cause of recursive call.
306 -- Uniform oneof tends not to build complex objects cause of recursive call.
@@ -321,4 +319,3 @@ instance Arbitrary v => Arbitrary (KeyMap.KeyMap v) where
321instance Arbitrary Key.Key where
319instance Arbitrary Key.Key where
322 arbitrary = Key.fromText <$> arbitrary
320 arbitrary = Key.fromText <$> arbitrary
323#endif
321#endif
324−#endif
test/Data/OpenApi/SchemaSpec.hs−4
@@ -59,9 +59,6 @@ checkInlinedRecSchema proxy js = inlineNonRecursiveSchemas defs s <=> js
59 where
59 where
60 (defs, s) = runDeclare (declareSchema proxy) mempty
60 (defs, s) = runDeclare (declareSchema proxy) mempty
61
61
62−checkToSchemaDeclare :: (HasCallStack, ToSchema a) => Proxy a -> Value -> Spec
63−checkToSchemaDeclare proxy js = runDeclare (declareSchemaRef proxy) mempty <=> js
64−
65spec :: Spec
62spec :: Spec
66spec = do
63spec = do
67 describe "Generic ToSchema" $ do
64 describe "Generic ToSchema" $ do
@@ -81,7 +78,6 @@ spec = do
81 context "UserId (non-record newtype)" $ checkToSchema (Proxy :: Proxy UserId) userIdSchemaJSON
78 context "UserId (non-record newtype)" $ checkToSchema (Proxy :: Proxy UserId) userIdSchemaJSON
82 context "Player (unary record)" $ checkToSchema (Proxy :: Proxy Player) playerSchemaJSON
79 context "Player (unary record)" $ checkToSchema (Proxy :: Proxy Player) playerSchemaJSON
83 context "SingleMaybeField (unary record with Maybe)" $ checkToSchema (Proxy :: Proxy SingleMaybeField) singleMaybeFieldSchemaJSON
80 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
85 context "Players (inlining schema)" $ checkToSchema (Proxy :: Proxy Players) playersSchemaJSON
81 context "Players (inlining schema)" $ checkToSchema (Proxy :: Proxy Players) playersSchemaJSON
86 context "MyRoseTree (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
82 context "MyRoseTree (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree) myRoseTreeSchemaJSON
87 context "MyRoseTree' (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree') myRoseTreeSchemaJSON'
83 context "MyRoseTree' (datatypeNameModifier)" $ checkToSchema (Proxy :: Proxy MyRoseTree') myRoseTreeSchemaJSON'