100 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
			
		
		
	
	
			100 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
| // Copyright 2020 Google Inc.
 | |
| //
 | |
| // Licensed under the Apache License, Version 2.0 (the "License");
 | |
| // you may not use this file except in compliance with the License.
 | |
| // You may obtain a copy of the License at
 | |
| //
 | |
| //      http://www.apache.org/licenses/LICENSE-2.0
 | |
| //
 | |
| // Unless required by applicable law or agreed to in writing, software
 | |
| // distributed under the License is distributed on an "AS IS" BASIS,
 | |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | |
| // See the License for the specific language governing permissions and
 | |
| // limitations under the License.
 | |
| //
 | |
| ////////////////////////////////////////////////////////////////////////////////
 | |
| 
 | |
| // The proto definition for JSON format has been written based on
 | |
| // http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
 | |
| 
 | |
| syntax = "proto2";
 | |
| 
 | |
| package json_proto;
 | |
| 
 | |
| message JsonParseAPI {
 | |
|   required int32 settings = 1;
 | |
|   required JsonObject object_value = 2;
 | |
| }
 | |
| 
 | |
| message JsonObject {
 | |
|   required int32 settings = 1;
 | |
|   required string name = 2;
 | |
|   required JsonValue value = 3;
 | |
| }
 | |
| 
 | |
| message JsonValue {
 | |
|   oneof value {
 | |
|     // Json value types:
 | |
| 
 | |
|     // null: null, will be used when 'oneof' contains nothing
 | |
| 
 | |
|     // object: another json object of any type
 | |
|     JsonObject object_value = 1;
 | |
| 
 | |
|     // array: an array of values
 | |
|     ArrayValue array_value = 2;
 | |
| 
 | |
|     // number: can be an integer, a float, an exponent
 | |
|     NumberValue number_value = 3;
 | |
| 
 | |
|     // string: unicode string
 | |
|     StringValue string_value = 4;
 | |
| 
 | |
|     // boolean: true or talse
 | |
|     BooleanValue boolean_value = 5;
 | |
|   }
 | |
| }
 | |
| 
 | |
| message ArrayValue {
 | |
|   repeated JsonValue value = 1;
 | |
| }
 | |
| 
 | |
| message NumberInteger {
 | |
|   required int64 value = 1;
 | |
| }
 | |
| 
 | |
| message NumberFloat {
 | |
|   required double value = 1;
 | |
| }
 | |
| 
 | |
| message NumberExponent {
 | |
|   required int32 base = 1;
 | |
|   required int32 exponent = 2;
 | |
|   required bool use_uppercase = 3;
 | |
| }
 | |
| 
 | |
| message NumberExponentFrac {
 | |
|   required float base = 1;
 | |
|   required int32 exponent = 2;
 | |
|   required bool use_uppercase = 3;
 | |
| }
 | |
| 
 | |
| message NumberValue {
 | |
|   required NumberInteger integer_value = 1;
 | |
| 
 | |
|   // integer_value is used when oneof field below has nothing.
 | |
|   oneof value {
 | |
|     NumberFloat float_value = 2;
 | |
|     NumberExponent exponent_value = 3;
 | |
|     NumberExponentFrac exponent_frac_value = 4;
 | |
|   }
 | |
| }
 | |
| 
 | |
| message StringValue {
 | |
|   required string value = 1;
 | |
| }
 | |
| 
 | |
| message BooleanValue {
 | |
|   required bool value = 1;
 | |
| }
 |