Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update swagger and proto-wire #232

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packages: ./*.cabal
source-repository-package
type: git
location: https://github.com/awakesecurity/proto3-wire
tag: 8096a1e19431af603655e5c1f2488b5db907836c
Comment on lines +1 to +5
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stack was already using a commit pin for proto3-wire, added one for cabal. Also updated the pin in stack (this provides a Data instance for FieldNumber)

12 changes: 6 additions & 6 deletions proto3-suite.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ library

if flag(dhall)
exposed-modules: Proto3.Suite.DhallPB
build-depends: dhall >=1.13 && < 1.39
build-depends: dhall >=1.13 && <= 1.41.2
cpp-options: -DDHALL

if flag(swagger)
exposed-modules: Proto3.Suite.DotProto.Generate.Swagger
Proto3.Suite.DotProto.Generate.Swagger.Wrappers
build-depends: swagger2 >=2.1.6 && <2.8
build-depends: swagger2 >=2.1.6 && <=2.8.6
cpp-options: -DSWAGGER
if flag(swagger-wrapper-format)
hs-source-dirs: src/swagger-wrapper-format
Expand All @@ -67,7 +67,7 @@ library

if flag(large-records)
-- large-records support uses newer Dhall APIs. So we need at least 1.34.
build-depends: dhall >=1.34 && < 1.39,
build-depends: dhall >=1.34 && <= 1.41.2,
large-generics,
large-records
cpp-options: -DLARGE_RECORDS
Expand Down Expand Up @@ -118,9 +118,9 @@ library
parsers >= 0.12 && <0.13,
pretty ==1.1.*,
pretty-show >= 1.6.12 && < 2.0,
proto3-wire >= 1.2.2 && < 1.5,
proto3-wire,
QuickCheck >=2.10 && <2.15,
quickcheck-instances < 0.4,
quickcheck-instances >=0.3.29 && < 0.4,
safe ==0.3.*,
split,
system-filepath,
Expand Down Expand Up @@ -148,7 +148,7 @@ test-suite tests

if flag(dhall)
other-modules: TestDhall
build-depends: dhall >=1.13 && < 1.39
build-depends: dhall >=1.13 && <= 1.41.2
cpp-options: -DDHALL

if flag(swagger)
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ packages:

extra-deps:
- github: awakesecurity/proto3-wire
commit: 9b1c178f8a23a5f03237cb77cce403bc386da523
commit: 8096a1e19431af603655e5c1f2488b5db907836c

nix:
packages:
Expand Down
16 changes: 8 additions & 8 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

packages:
- completed:
size: 45006
url: https://github.com/awakesecurity/proto3-wire/archive/9b1c178f8a23a5f03237cb77cce403bc386da523.tar.gz
name: proto3-wire
version: 1.2.2
sha256: df812fdfe6c7df641d310c6273c16de4fda8f4d61635f084e24937ca0b91944c
pantry-tree:
size: 1325
sha256: bf3471cb92d5c273bf1163594380e836b48917a076b08827286a32f3d2320dee
sha256: fb014dc4be245b77a8f0cec3729164f213954a207b21a4dfe51bf1f96d26747f
size: 1608
sha256: 9a76c581dab0709560c5e6cd824b2c95be98cea76f8380f11f64974b399dc650
size: 48185
url: https://github.com/awakesecurity/proto3-wire/archive/8096a1e19431af603655e5c1f2488b5db907836c.tar.gz
version: 1.4.1
original:
url: https://github.com/awakesecurity/proto3-wire/archive/9b1c178f8a23a5f03237cb77cce403bc386da523.tar.gz
url: https://github.com/awakesecurity/proto3-wire/archive/8096a1e19431af603655e5c1f2488b5db907836c.tar.gz
snapshots:
- completed:
sha256: c632012da648385b9fa3c29f4e0afd56ead299f1c5528ee789058be410e883c0
size: 585393
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/0.yaml
sha256: c632012da648385b9fa3c29f4e0afd56ead299f1c5528ee789058be410e883c0
original:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/0.yaml
5 changes: 0 additions & 5 deletions tests/ArbitraryGeneratedTestTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
module ArbitraryGeneratedTestTypes where

import Data.String (fromString)
import qualified Data.Text.Short as TS
import qualified Data.Vector as V
import qualified Proto3.Suite.Types as DotProto
import Test.QuickCheck (listOf)
Expand All @@ -15,10 +14,6 @@ import qualified TestProtoImport
import qualified TestProtoOneof
import qualified TestProtoOneofImport

instance Arbitrary TS.ShortText where
arbitrary = fmap TS.fromText arbitrary
shrink = map TS.fromText . shrink . TS.toText

Comment on lines -18 to -21
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arbitrary instance for ShortText already provided by quickcheck-instances, this is the reason I increased the lower bound on that dep.

instance Arbitrary Trivial where
arbitrary = Trivial <$> arbitrary

Expand Down
8 changes: 4 additions & 4 deletions tests/TestCodeGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ swaggerWrapperFormat = testGroup "Swagger Wrapper Format"
"{\"properties\":{\"wrapper\":{\"format\":\"float\",\"type\":\"number\"}},\"type\":\"object\"}"
, expectSchema @TestProtoWrappers.TestInt64Value
"{\"properties\":{\"wrapper\":{\"maximum\":9223372036854775807,\"format\":\"Int64Value\",\"minimum\":-9223372036854775808,\"type\":\"integer\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"maximum\":9223372036854775807,\"format\":\"int64\",\"minimum\":-9223372036854775808,\"type\":\"integer\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"format\":\"int64\",\"maximum\":9223372036854775807,\"minimum\":-9223372036854775808,\"type\":\"integer\"}},\"type\":\"object\"}"
, expectSchema @TestProtoWrappers.TestUInt64Value
"{\"properties\":{\"wrapper\":{\"maximum\":18446744073709551615,\"format\":\"UInt64Value\",\"minimum\":0,\"type\":\"integer\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"maximum\":18446744073709551615,\"minimum\":0,\"type\":\"integer\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"format\":\"int64\",\"maximum\":18446744073709551615,\"minimum\":0,\"type\":\"integer\"}},\"type\":\"object\"}"
, expectSchema @TestProtoWrappers.TestInt32Value
"{\"properties\":{\"wrapper\":{\"maximum\":2147483647,\"format\":\"Int32Value\",\"minimum\":-2147483648,\"type\":\"integer\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"maximum\":2147483647,\"format\":\"int32\",\"minimum\":-2147483648,\"type\":\"integer\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"format\":\"int32\",\"maximum\":2147483647,\"minimum\":-2147483648,\"type\":\"integer\"}},\"type\":\"object\"}"
, expectSchema @TestProtoWrappers.TestUInt32Value
"{\"properties\":{\"wrapper\":{\"maximum\":4294967295,\"format\":\"UInt32Value\",\"minimum\":0,\"type\":\"integer\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"maximum\":4294967295,\"minimum\":0,\"type\":\"integer\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"format\":\"int32\",\"maximum\":4294967295,\"minimum\":0,\"type\":\"integer\"}},\"type\":\"object\"}"
Comment on lines +69 to +78
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New swagger seems to sort keys alphabetically now.

, expectSchema @TestProtoWrappers.TestBoolValue
"{\"properties\":{\"wrapper\":{\"format\":\"BoolValue\",\"type\":\"boolean\"}},\"type\":\"object\"}"
"{\"properties\":{\"wrapper\":{\"type\":\"boolean\"}},\"type\":\"object\"}"
Expand Down