This repo checks that (u)int64s are encoded correctly into JSON. As explained in the Discovery file description and specified in the protobuf documentation these types must be encoded as strings as per the JSON standard.
Run cd proto && ./generate.sh
to generate the protobuf stubs for your language. Then go to your language directory to run the code.
int32
anduint32
are JSON encoded as numbers, regardless of magnitudeint64
anduint64
are JSON encoded as strings, regardless of magnitude
- Go: PASSED (tested here:
go run main.go
) - Python: PASSED (tested here:
python3 main.py
) - PHP: PASSED (tested separately)
- Java: PASSED (tested here:
mvn compile && mvn exec:java
) - C#: PASSED (tested here
(cd csharp && dotnet build && dotnet ./bin/Debug/netstandard2.0/csharp.dll)
) - Ruby: PASSED (tested here
ruby ./ruby/main.rb
)
protoc generates code for both the top-level and nested enum types, even though neither is used as a field type. The languages tested all seem to do that, as indicated by GENERATED
below.
- Go: GENERATED
- string from enum:
EndingLetters_OMEGA.String()
- enum from string:
EndingLetters_value["OMEGA"]
- string from enum:
- Java: GENERATED
- C#: GENERATED
- Python: GENERATED
- string from enum and enum from string can beaccessed through ProtoPlus
- Ruby: GENERATED
- PHP: GENERATED
- string from enum:
name(...)
- enum from string:
value(...)
- string from enum:
- JavaScript: GENERATED
- Add instructions to
proto/generate.sh
to generate the proto stubs for your language - Make a top-level directory for your language.
- Create a small program that will populate all fields with small and large values. See the
go/main.go
implementation for an example. - Add the results of your investigation above.
- Commit your new source files and the generated proto stubs.