Skip to content

Commit f70abe2

Browse files
benjieleebyron
andauthored
Recommend that order of unordered collections is maintained where possible (#1092)
* Add recommendation to preserve order where possible * wordsmithing * another round of clarification * explicit data structure in example * use 'required' --------- Co-authored-by: Lee Byron <[email protected]>
1 parent 11c6664 commit f70abe2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

spec/Appendix B -- Notation Conventions.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,9 @@ entry has a unique key, and can be directly referenced by that key.
247247
:: An _ordered map_ is a map which has a defined order. An entry added to an
248248
ordered map, which does not have an entry with that key, is ordered after
249249
existing entries.
250+
251+
Note: This specification defines ordered data collection only when strictly
252+
required. When an order is observable, implementations should preserve it to
253+
improve output legibility and stability. For example if applying a grammar to an
254+
input string yields a _set_ of elements, serialization should emit those
255+
elements in the same source order.

spec/Section 4 -- Introspection.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ Tools built using GraphQL introspection should respect deprecation by
117117
discouraging deprecated use through information hiding or developer-facing
118118
warnings.
119119

120+
**Stable Ordering**
121+
122+
The observable order of all data collections should be preserved to improve
123+
schema legibility and stability. When a schema is produced from a
124+
{TypeSystemDocument}, introspection should return items in the same source order
125+
for each element list: object fields, input object fields, arguments, enum
126+
values, directives, union member types, and implemented interfaces.
127+
120128
**Schema Introspection Schema**
121129

122130
The schema introspection system is itself represented as a GraphQL schema. Below

0 commit comments

Comments
 (0)