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

Extend proto-lens API to support serializing the protobuf JSON format #455

Open
wants to merge 9 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
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "google/protobuf"]
path = google/protobuf
[submodule "proto-lens-protobuf-types/proto-src"]
path = proto-lens-protobuf-types/proto-src
url = https://github.com/google/protobuf
6 changes: 3 additions & 3 deletions discrimination-ieee754/discrimination-ieee754.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -31,7 +31,7 @@ library
hs-source-dirs:
src
build-depends:
base >=4.10 && <4.17
base >=4.10 && <4.19
, contravariant >=1.3 && <1.6
, data-binary-ieee754 ==0.4.*
, discrimination >=0.3 && <0.6
Expand All @@ -46,7 +46,7 @@ test-suite test
test
build-depends:
QuickCheck
, base >=4.10 && <4.17
, base >=4.10 && <4.19
, contravariant >=1.3 && <1.6
, data-binary-ieee754 ==0.4.*
, discrimination >=0.3 && <0.6
Expand Down
2 changes: 1 addition & 1 deletion discrimination-ieee754/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license: BSD3
github: google/proto-lens/discrimination-ieee754

dependencies:
- base >= 4.10 && < 4.17
- base >= 4.10 && < 4.19
- data-binary-ieee754 >= 0.4 && < 0.5
- contravariant >= 1.3 && < 1.6
- discrimination >= 0.3 && < 0.6
Expand Down
1 change: 0 additions & 1 deletion google/protobuf
Submodule protobuf deleted from 2514f0
6 changes: 3 additions & 3 deletions proto-lens-arbitrary/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ extra-source-files:

dependencies:
- proto-lens >= 0.4 && < 0.8
- base >= 4.10 && < 4.17
- bytestring >= 0.10 && < 0.12
- base >= 4.10 && < 4.19
- bytestring >= 0.10 && < 0.13
- containers >= 0.5 && < 0.7
- text >= 1.2 && < 2.1
- text >= 1.2 && < 2.2
- lens-family >= 1.2 && < 2.2
- QuickCheck >= 2.8 && < 2.15

Expand Down
8 changes: 4 additions & 4 deletions proto-lens-arbitrary/proto-lens-arbitrary.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -34,10 +34,10 @@ library
src
build-depends:
QuickCheck >=2.8 && <2.15
, base >=4.10 && <4.17
, bytestring >=0.10 && <0.12
, base >=4.10 && <4.19
, bytestring >=0.10 && <0.13
, containers >=0.5 && <0.7
, lens-family >=1.2 && <2.2
, proto-lens >=0.4 && <0.8
, text >=1.2 && <2.1
, text >=1.2 && <2.2
default-language: Haskell2010
4 changes: 2 additions & 2 deletions proto-lens-arbitrary/src/Data/ProtoLens/Arbitrary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ arbitraryField (FieldDescriptor _ ftd fa) = case fa of
PlainField _ l -> setGen l fieldGen
OptionalField l -> setGen l (maybeGen fieldGen)
RepeatedField _ l -> setGen l (listOf fieldGen)
MapField keyLens valueLens mapLens ->
MapField _ _ keyLens valueLens mapLens ->
setGen mapLens (mapGen keyLens valueLens fieldGen)
where
fieldGen = arbitraryFieldValue ftd
Expand Down Expand Up @@ -131,7 +131,7 @@ shrinkField (FieldDescriptor _ ftd fa) = case fa of
PlainField _ l -> l fieldShrinker
OptionalField l -> l (shrinkMaybe fieldShrinker)
RepeatedField _ l -> l (shrinkList fieldShrinker)
MapField keyLens valueLens mapLens ->
MapField _ _ keyLens valueLens mapLens ->
mapLens (shrinkMap keyLens valueLens fieldShrinker)
where
fieldShrinker = shrinkFieldValue ftd
Expand Down
4 changes: 3 additions & 1 deletion proto-lens-benchmarks/proto-lens-benchmarks.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.0

-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -32,6 +32,8 @@ library
Data.ProtoLens.BenchmarkUtil
other-modules:
Paths_proto_lens_benchmarks
autogen-modules:
Paths_proto_lens_benchmarks
hs-source-dirs:
src
ghc-options: -O2 -rtsopts
Expand Down
8 changes: 4 additions & 4 deletions proto-lens-discrimination/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ extra-source-files:

custom-setup:
dependencies:
- base >= 4.10 && < 4.17
- base >= 4.10 && < 4.19
- Cabal
- proto-lens-setup >= 0.4 && < 0.5

build-tools: proto-lens-protoc:proto-lens-protoc

dependencies:
- base >= 4.11 && < 4.17
- bytestring >= 0.10 && < 0.12
- base >= 4.11 && < 4.19
- bytestring >= 0.10 && < 0.13
- contravariant >= 1.3 && < 1.6
- containers >= 0.5 && < 0.7
- discrimination >= 0.3 && < 0.6
- discrimination-ieee754 == 0.1.*
- lens-family >= 1.2 && < 2.2
- proto-lens >= 0.6 && < 0.8
- text >= 1.2 && < 2.1
- text >= 1.2 && < 2.2

library:
source-dirs: src
Expand Down
19 changes: 11 additions & 8 deletions proto-lens-discrimination/proto-lens-discrimination.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.0

-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -29,7 +29,7 @@ source-repository head
custom-setup
setup-depends:
Cabal
, base >=4.10 && <4.17
, base >=4.10 && <4.19
, proto-lens-setup ==0.4.*

library
Expand All @@ -39,20 +39,22 @@ library
Data.ProtoLens.Discrimination
other-modules:
Paths_proto_lens_discrimination
autogen-modules:
Paths_proto_lens_discrimination
hs-source-dirs:
src
build-tool-depends:
proto-lens-protoc:proto-lens-protoc
build-depends:
base >=4.11 && <4.17
, bytestring >=0.10 && <0.12
base >=4.11 && <4.19
, bytestring >=0.10 && <0.13
, containers >=0.5 && <0.7
, contravariant >=1.3 && <1.6
, discrimination >=0.3 && <0.6
, discrimination-ieee754 ==0.1.*
, lens-family >=1.2 && <2.2
, proto-lens >=0.6 && <0.8
, text >=1.2 && <2.1
, text >=1.2 && <2.2
default-language: Haskell2010

test-suite discrimination_test
Expand All @@ -65,6 +67,7 @@ test-suite discrimination_test
Proto.Map
Proto.Map_Fields
autogen-modules:
Paths_proto_lens_discrimination
Proto.Enum
Proto.Enum_Fields
Proto.Map
Expand All @@ -76,8 +79,8 @@ test-suite discrimination_test
build-depends:
HUnit >=1.3 && <1.7
, QuickCheck >=2.8 && <2.15
, base >=4.11 && <4.17
, bytestring >=0.10 && <0.12
, base >=4.11 && <4.19
, bytestring >=0.10 && <0.13
, containers >=0.5 && <0.7
, contravariant >=1.3 && <1.6
, discrimination >=0.3 && <0.6
Expand All @@ -90,5 +93,5 @@ test-suite discrimination_test
, test-framework ==0.8.*
, test-framework-hunit ==0.3.*
, test-framework-quickcheck2 ==0.3.*
, text >=1.2 && <2.1
, text >=1.2 && <2.2
default-language: Haskell2010
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ discFieldAccessor discList discMaybe c f = case f of
PlainField _ l -> view l >$< c
OptionalField l -> view l >$< discMaybe c
RepeatedField _ l -> view l >$< discList c
MapField k v l -> view l >$< discProtoMapAssocs discList c k v
MapField _ _ k v l -> view l >$< discProtoMapAssocs discList c k v

-- Unpack a ByteString into a Word16 and the remainder, or the leftover 0 or 1
-- bytes at the end.
Expand Down
5 changes: 5 additions & 0 deletions proto-lens-json/Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog for `proto-lens-json`

## 0.1.0.0
Initial version.

30 changes: 30 additions & 0 deletions proto-lens-json/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2016, Google Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Google Inc. nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 2 additions & 0 deletions proto-lens-json/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
31 changes: 31 additions & 0 deletions proto-lens-json/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: proto-lens-json
version: "0.0.1.0"
synopsis: JSON instances for proto-lens.
description: >
The proto-lens-json allows generating arbitrary messages for
use with Aeson.
category: Data
author: Ian Duncan
maintainer: [email protected]
copyright: Google Inc.
license: BSD3
github: google/proto-lens/proto-lens-json
extra-source-files:
- Changelog.md

dependencies:
- proto-lens >= 0.4 && < 0.9
- base >= 4.10 && < 4.19
- bytestring >= 0.10 && < 0.13
- containers >= 0.5 && < 0.7
- text >= 1.2 && < 2.2
- lens-family >= 1.2 && < 2.2
- aeson >= 2.0 && < 2.3
- base64 >= 0.4.2 && < 0.5
- proto-lens-protobuf-types >= 0.7 && < 0.9
- time
- split
library:
source-dirs: src
exposed-modules:
- Data.ProtoLens.Json
47 changes: 47 additions & 0 deletions proto-lens-json/proto-lens-json.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.5.
--
-- see: https://github.com/sol/hpack

name: proto-lens-json
version: 0.0.1.0
synopsis: JSON instances for proto-lens.
description: The proto-lens-json allows generating arbitrary messages for use with Aeson.
category: Data
homepage: https://github.com/google/proto-lens#readme
bug-reports: https://github.com/google/proto-lens/issues
author: Ian Duncan
maintainer: [email protected]
copyright: Google Inc.
license: BSD3
license-file: LICENSE
build-type: Simple
extra-source-files:
Changelog.md

source-repository head
type: git
location: https://github.com/google/proto-lens
subdir: proto-lens-json

library
exposed-modules:
Data.ProtoLens.Json
other-modules:
Paths_proto_lens_json
hs-source-dirs:
src
build-depends:
aeson >=2.0 && <2.3
, base >=4.10 && <4.19
, base64 >=0.4.2 && <0.5
, bytestring >=0.10 && <0.13
, containers >=0.5 && <0.7
, lens-family >=1.2 && <2.2
, proto-lens >=0.4 && <0.9
, proto-lens-protobuf-types >=0.7 && <0.9
, split
, text >=1.2 && <2.2
, time
default-language: Haskell2010
Loading
Loading