Skip to content

Commit 254e0eb

Browse files
committed
jsoncstyleguide: sync from latest internal version
PiperOrigin-RevId: 751434392
1 parent 4a107ba commit 254e0eb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

jsoncstyleguide.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This style guide contains many details that are initially hidden from view. The
2121
</STYLEPOINT>
2222
</CATEGORY>
2323
<CATEGORY title="Introduction">
24-
<p>This style guide documents guidelines and recommendations for building JSON APIs at Google. In general, JSON APIs should follow the spec found at <a href="http://www.json.org">JSON.org</a>. This style guide clarifies and standardizes specific cases so that JSON APIs from Google have a standard look and feel. These guidelines are applicable to JSON requests and responses in both RPC-based and REST-based APIs.</p>
24+
<p>This style guide documents guidelines and recommendations for building JSON APIs at Google. In general, JSON APIs should follow the spec found at <a href="https://www.json.org">JSON.org</a>. This style guide clarifies and standardizes specific cases so that JSON APIs from Google have a standard look and feel. These guidelines are applicable to JSON requests and responses in both RPC-based and REST-based APIs.</p>
2525
</CATEGORY>
2626
<CATEGORY title="Definitions">
2727
<p>For the purposes of this style guide, we define the following terms:</p><ul><li><b>property</b> - a name/value pair inside a JSON object.</li><li><b>property name</b> - the name (or key) portion of the property.</li><li><b>property value</b> - the value portion of the property.</li></ul>
@@ -129,8 +129,8 @@ JSON maps can use any Unicode character in key names.
129129
// The "thumbnails" property is a map that maps
130130
// a pixel size to the thumbnail url of that size.
131131
"thumbnails": {
132-
"72": "http://url.to.72px.thumbnail",
133-
"144": "http://url.to.144px.thumbnail"
132+
"72": "https://url.to.72px.thumbnail",
133+
"144": "https://url.to.144px.thumbnail"
134134
}
135135
}
136136

@@ -212,10 +212,10 @@ Avoid naming conflicts by choosing a new property name or versioning the API.
212212
<CATEGORY title="Property Value Guidelines">
213213
<STYLEPOINT title="Property Value Format">
214214
<SUMMARY>
215-
Property values must be Unicode booleans, numbers, strings, objects, arrays, or <code>null</code>.
215+
Property values must be booleans, numbers, Unicode strings, objects, arrays, or <code>null</code>.
216216
</SUMMARY>
217217
<BODY>
218-
<p>The spec at <a href="http://www.json.org">JSON.org</a> specifies exactly what type of data is allowed in a property value. This includes Unicode booleans, numbers, strings, objects, arrays, and <code>null</code>. JavaScript expressions are not allowed. APIs should support that spec for all values, and should choose the data type most appropriate for a particular property (numbers to represent numbers, etc.).</p><p>Good:</p>
218+
<p>The spec at <a href="https://www.json.org">JSON.org</a> specifies exactly what type of data is allowed in a property value. This includes booleans, numbers, Unicode strings, objects, arrays, and <code>null</code>. JavaScript expressions are not allowed. APIs should support that spec for all values, and should choose the data type most appropriate for a particular property (numbers to represent numbers, etc.).</p><p>Good:</p>
219219
<CODE_SNIPPET>
220220
{
221221
"canPigsFly": null, // null
@@ -334,7 +334,7 @@ Latitudes/Longitudes should be formatted as recommended by ISO 6709.
334334
</STYLEPOINT>
335335
</CATEGORY>
336336
<CATEGORY title="JSON Structure &amp; Reserved Property Names">
337-
<p>In order to maintain a consistent interface across APIs, JSON objects should follow the structure outlined below. This structure applies to both requests and responses made with JSON. Within this structure, there are certain property names that are reserved for specific uses. These properties are NOT required; in other words, each reserved property may appear zero or one times. But if a service needs these properties, this naming convention is recommend. Here is a schema of the JSON structure, represented in <a href="https://www.google.com/url?sa=D&amp;q=http%3A%2F%2Forderly-json.org%2F">Orderly</a> format (which in turn can be compiled into a <a href="https://www.google.com/url?sa=D&amp;q=http%3A%2F%2Fjson-schema.org%2F">JSONSchema</a>). You can few examples of the JSON structure at the end of this guide.</p>
337+
<p>In order to maintain a consistent interface across APIs, JSON objects should follow the structure outlined below. This structure applies to both requests and responses made with JSON. Within this structure, there are certain property names that are reserved for specific uses. These properties are NOT required; in other words, each reserved property may appear zero or one times. But if a service needs these properties, this naming convention is recommended. Here is a schema of the JSON structure, represented in <a href="https://www.google.com/url?sa=D&amp;q=http%3A%2F%2Forderly-json.org%2F">Orderly</a> format (which in turn can be compiled into a <a href="https://www.google.com/url?sa=D&amp;q=http%3A%2F%2Fjson-schema.org%2F">JSONSchema</a>). You can few examples of the JSON structure at the end of this guide.</p>
338338
<CODE_SNIPPET>
339339
object {
340340
string apiVersion?;
@@ -661,7 +661,7 @@ Property Value Type: array<br />Parent: <code>data</code>
661661
</STYLEPOINT>
662662
</CATEGORY>
663663
<CATEGORY title="Reserved Property Names for Paging">
664-
<p>The following properties are located in the <code>data</code> object, and help page through a list of items. Some of the language and concepts are borrowed from the <a href="http://www.opensearch.org/Home">OpenSearch specification</a>.</p><p>The paging properties below allow for various styles of paging, including:</p><ul><li>Previous/Next paging - Allows user's to move forward and backward through a list, one page at a time. The <code>nextLink</code> and <code>previousLink</code> properties (described in the "Reserved Property Names for Links" section below) are used for this style of paging.</li><li>Index-based paging - Allows user's to jump directly to a specific item position within a list of items. For example, to load 10 items starting at item 200, the developer may point the user to a url with the query string <code>?startIndex=200</code>.</li><li>Page-based paging - Allows user's to jump directly to a specific page within the items. This is similar to index-based paging, but saves the developer the extra step of having to calculate the item index for a new page of items. For example, rather than jump to item number 200, the developer could jump to page 20. The urls during page-based paging could use the query string <code>?page=1</code> or <code>?page=20</code>. The <code>pageIndex</code> and <code>totalPages</code> properties are used for this style of paging.</li></ul><p>An example of how to use these properties to implement paging can be found at the end of this guide.</p>
664+
<p>The following properties are located in the <code>data</code> object, and help page through a list of items. Some of the language and concepts are borrowed from the <a href="https://www.opensearch.org/">OpenSearch specification</a>.</p><p>The paging properties below allow for various styles of paging, including:</p><ul><li>Previous/Next paging - Allows user's to move forward and backward through a list, one page at a time. The <code>nextLink</code> and <code>previousLink</code> properties (described in the "Reserved Property Names for Links" section below) are used for this style of paging.</li><li>Index-based paging - Allows user's to jump directly to a specific item position within a list of items. For example, to load 10 items starting at item 200, the developer may point the user to a url with the query string <code>?startIndex=200</code>.</li><li>Page-based paging - Allows user's to jump directly to a specific page within the items. This is similar to index-based paging, but saves the developer the extra step of having to calculate the item index for a new page of items. For example, rather than jump to item number 200, the developer could jump to page 20. The urls during page-based paging could use the query string <code>?page=1</code> or <code>?page=20</code>. The <code>pageIndex</code> and <code>totalPages</code> properties are used for this style of paging.</li></ul><p>An example of how to use these properties to implement paging can be found at the end of this guide.</p>
665665
<STYLEPOINT title="data.currentItemCount">
666666
<SUMMARY>
667667
Property Value Type: integer<br />Parent: <code>data</code>
@@ -935,7 +935,7 @@ Property Value Type: string<br />Parent: <code>error.errors</code>
935935
<CODE_SNIPPET>
936936
{
937937
"error":{
938-
"code": 404
938+
"code": 404,
939939
"message": "File Not Found",
940940
"errors": [{"message": "File Not Found"}]
941941
}
@@ -985,7 +985,7 @@ Property Value Type: string<br />Parent: <code>error.errors</code>
985985
<CODE_SNIPPET>
986986
{
987987
"error":{
988-
"errors": [{"extendedHelper": "http://url.to.more.details.example.com/"}]
988+
"errors": [{"extendedHelper": "https://url.to.more.details.example.com/"}]
989989
}
990990
}
991991

0 commit comments

Comments
 (0)