Skip to content

Commit acfe2ac

Browse files
authored
PHPLIB-1598 Use named types for enums (#1570)
1 parent 8b84786 commit acfe2ac

22 files changed

+49
-48
lines changed

generator/config/accumulator/bottom.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ arguments:
1212
-
1313
name: sortBy
1414
type:
15-
- object # SortSpec
15+
- sortBy
1616
description: |
1717
Specifies the order of results, with syntax similar to $sort.
1818
-

generator/config/accumulator/bottomN.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ arguments:
1919
-
2020
name: sortBy
2121
type:
22-
- object # SortSpec
22+
- sortBy
2323
description: |
2424
Specifies the order of results, with syntax similar to $sort.
2525
-

generator/config/accumulator/median.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ arguments:
2222
-
2323
name: method
2424
type:
25-
- string # AccumulatorPercentile
25+
- accumulatorPercentile
2626
description: |
2727
The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'.
2828
tests:

generator/config/accumulator/percentile.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ arguments:
3232
-
3333
name: method
3434
type:
35-
- string # AccumulatorPercentile
35+
- accumulatorPercentile
3636
description: |
3737
The method that mongod uses to calculate the percentile value. The method must be 'approximate'.
3838
tests:

generator/config/accumulator/top.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ arguments:
1313
-
1414
name: sortBy
1515
type:
16-
- object # SortSpec
16+
- sortBy
1717
description: |
1818
Specifies the order of results, with syntax similar to $sort.
1919
-

generator/config/accumulator/topN.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ arguments:
1919
-
2020
name: sortBy
2121
type:
22-
- object # SortSpec
22+
- sortBy
2323
description: |
2424
Specifies the order of results, with syntax similar to $sort.
2525
-

generator/config/expression/median.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ arguments:
2222
-
2323
name: method
2424
type:
25-
- string # AccumulatorPercentile
25+
- accumulatorPercentile
2626
description: |
2727
The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'.
2828
tests:

generator/config/expression/percentile.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ arguments:
3232
-
3333
name: method
3434
type:
35-
- string # AccumulatorPercentile
35+
- accumulatorPercentile
3636
description: |
3737
The method that mongod uses to calculate the percentile value. The method must be 'approximate'.
3838
tests:

generator/config/expression/sortArray.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ arguments:
1818
-
1919
name: sortBy
2020
type:
21-
- object # SortSpec
2221
- int
2322
- sortSpec
23+
- sortBy
2424
description: |
2525
The document specifies a sort ordering.
2626
tests:

generator/config/expressions.php

+10-19
Original file line numberDiff line numberDiff line change
@@ -131,45 +131,36 @@
131131
],
132132

133133
// @todo add enum values
134-
'Granularity' => [
134+
'granularity' => [
135135
'acceptedTypes' => [...$bsonTypes['string']],
136136
],
137-
'FullDocument' => [
137+
'fullDocument' => [
138138
'acceptedTypes' => [...$bsonTypes['string']],
139139
],
140-
'FullDocumentBeforeChange' => [
140+
'fullDocumentBeforeChange' => [
141141
'acceptedTypes' => [...$bsonTypes['string']],
142142
],
143-
'AccumulatorPercentile' => [
143+
'accumulatorPercentile' => [
144144
'acceptedTypes' => [...$bsonTypes['string']],
145145
],
146-
'WhenMatched' => [
146+
'whenMatched' => [
147147
'acceptedTypes' => [...$bsonTypes['string']],
148148
],
149-
'WhenNotMatched' => [
149+
'whenNotMatched' => [
150150
'acceptedTypes' => [...$bsonTypes['string']],
151151
],
152152

153153
// @todo create specific model classes factories
154-
'OutCollection' => [
154+
'outCollection' => [
155155
'acceptedTypes' => [...$bsonTypes['object']],
156156
],
157-
'CollStats' => [
157+
'range' => [
158158
'acceptedTypes' => [...$bsonTypes['object']],
159159
],
160-
'Range' => [
160+
'sortBy' => [
161161
'acceptedTypes' => [...$bsonTypes['object']],
162162
],
163-
'FillOut' => [
164-
'acceptedTypes' => [...$bsonTypes['object']],
165-
],
166-
'SortSpec' => [
167-
'acceptedTypes' => [...$bsonTypes['object']],
168-
],
169-
'Window' => [
170-
'acceptedTypes' => [...$bsonTypes['object']],
171-
],
172-
'GeoPoint' => [
163+
'geoPoint' => [
173164
'acceptedTypes' => [...$bsonTypes['object']],
174165
],
175166

generator/config/schema.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"name": {
1010
"$comment": "The name of the operator. Must start with a $",
1111
"type": "string",
12-
"pattern": "^\\$[a-z0-9][a-zA-Z0-9]*$"
12+
"pattern": "^\\$?[a-z][a-zA-Z0-9]*$"
1313
},
1414
"link": {
1515
"$comment": "The link to the operator's documentation on MongoDB's website.",
@@ -122,6 +122,16 @@
122122
"timeUnit",
123123
"sortSpec",
124124
"any",
125+
"granularity",
126+
"fullDocument",
127+
"fullDocumentBeforeChange",
128+
"accumulatorPercentile",
129+
"whenMatched",
130+
"whenNotMatched",
131+
"outCollection",
132+
"range",
133+
"sortBy",
134+
"geoPoint",
125135
"resolvesToNumber", "numberFieldPath", "number",
126136
"resolvesToDouble", "doubleFieldPath", "double",
127137
"resolvesToString", "stringFieldPath", "string",

generator/config/stage/bucketAuto.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ arguments:
3030
-
3131
name: granularity
3232
type:
33-
- object # Granularity
33+
- granularity
3434
optional: true
3535
description: |
3636
A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10.

generator/config/stage/changeStream.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ arguments:
1717
-
1818
name: fullDocument
1919
type:
20-
- string # FullDocument
20+
- fullDocument
2121
optional: true
2222
description: |
2323
Specifies whether change notifications include a copy of the full document when modified by update operations.
2424
-
2525
name: fullDocumentBeforeChange
2626
type:
27-
- string # FullDocumentBeforeChange
27+
- fullDocumentBeforeChange
2828
optional: true
2929
description: |
3030
Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available.

generator/config/stage/densify.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ arguments:
2525
-
2626
name: range
2727
type:
28-
- object # Range
28+
- range
2929
description: |
3030
Specification for range based densification.
3131
tests:

generator/config/stage/fill.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ arguments:
2929
-
3030
name: sortBy
3131
type:
32-
- object # SortSpec
32+
- sortBy
3333
optional: true
3434
description: |
3535
Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage.

generator/config/stage/geoNear.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ arguments:
5454
-
5555
name: near
5656
type:
57-
- object # GeoPoint
57+
- geoPoint
5858
- resolvesToObject
5959
description: |
6060
The point for which to find the closest documents.

generator/config/stage/merge.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ arguments:
1212
name: into
1313
type:
1414
- string
15-
- object # OutCollection
15+
- outCollection
1616
description: |
1717
The output collection.
1818
-
@@ -33,15 +33,15 @@ arguments:
3333
-
3434
name: whenMatched
3535
type:
36-
- string # WhenMatched
36+
- whenMatched
3737
- pipeline
3838
optional: true
3939
description: |
4040
The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s).
4141
-
4242
name: whenNotMatched
4343
type:
44-
- string # WhenNotMatched
44+
- whenNotMatched
4545
optional: true
4646
description: |
4747
The behavior of $merge if a result document does not match an existing document in the out collection.

generator/config/stage/out.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ arguments:
1010
- name: coll
1111
type:
1212
- string
13-
- object # OutCollection
13+
- outCollection
1414
description: |
1515
Target database name to write documents from $out to.
1616
tests:

generator/config/stage/setWindowFields.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ arguments:
1111
-
1212
name: sortBy
1313
type:
14-
- object # SortSpec
14+
- sortBy
1515
description: |
1616
Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting.
1717
-

src/Builder/Stage/BucketAutoStage.php

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Stage/FactoryTrait.php

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Stage/FluentFactoryTrait.php

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)