diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-09-16 01:15:42 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-09-17 11:36:10 +0200 |
commit | 15005289f592f7a574f8947d09ab4cc6f6f2bd2e (patch) | |
tree | efb9a6fff7b0371775dd2c8befa70e0aa679832a /sonar-core/src/test/protobuf | |
parent | 361c419cb05a0fcb1ba6840a3aab736bb3f65b86 (diff) | |
download | sonarqube-15005289f592f7a574f8947d09ab4cc6f6f2bd2e.tar.gz sonarqube-15005289f592f7a574f8947d09ab4cc6f6f2bd2e.zip |
Improve protobuf to json converter
- replace bool field *PresentIfEmpty by a wrapper of repeated fields
- support arrays/maps in map values
Diffstat (limited to 'sonar-core/src/test/protobuf')
-rw-r--r-- | sonar-core/src/test/protobuf/test.proto | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/sonar-core/src/test/protobuf/test.proto b/sonar-core/src/test/protobuf/test.proto index fc86fe39521..5b55eded0e7 100644 --- a/sonar-core/src/test/protobuf/test.proto +++ b/sonar-core/src/test/protobuf/test.proto @@ -45,24 +45,53 @@ message PrimitiveTypeMsg { optional NestedMsg nested = 8; } -message ArrayFieldMsg { +message TestArray { repeated string strings = 1; repeated NestedMsg nesteds = 2; - - // naming convention. A boolean field is used - // to know if the repeated field is present. - optional bool nullableArrayPresentIfEmpty = 3; - repeated string nullableArray = 4; } message NestedMsg { optional string label = 1; } -message MapMsg { +message TestMap { map<string,string> stringMap = 1; map<string,NestedMsg> nestedMap = 2; +} + +message TestNullableArray { + optional string label = 1; + + // allow to make the difference between null and empty array + optional Countries countries = 2; +} + +message TestNullableMap { + optional string label = 1; + + // allow to make the difference between null and empty map + optional Translations translations = 2; +} + +message TestMapOfArray { + // allow to have map values of arrays + map<string, Countries> moneys = 1; +} + +message TestMapOfMap { + // allow to have map values of maps + map<string, Translations> catalogs = 1; +} + +message Translations { + map<string,string> translations = 1; +} + +message Countries { + repeated Country countries = 1; +} - optional bool nullableStringMapPresentIfEmpty = 3; - map<string,string> nullableStringMap = 4; +message Country { + optional string name = 1; + optional string continent = 2; } |