Skip to content

draft: augment yaml definitions with test schema #1659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 21 commits into
base: v2.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generator/config/expression/gt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ arguments:
-
name: expression2
type:
- expression
- expression # lack of backreferral is an issue here
tests:
-
name: 'Example'
Expand Down
14 changes: 7 additions & 7 deletions generator/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@
}
},
"encode": {
"$comment": "Specifies how operator parameters are encoded.",
"$comment": "array: parameters are encoded as an array of values in the order they are defined by the spec",
"$comment": "object: parameters are encoded as an object with keys matching the parameter names",
"$comment": "single: get the single parameter value",
"$comment": "group: specific for $group stage",
"$comment": [
"Specifies how operator parameters are encoded.",
"array: parameters are encoded as an array of values in the order they are defined by the spec",
"object: parameters are encoded as an object with keys matching the parameter names",
"single: get the single parameter value"
],
"type": "string",
"enum": [
"array",
"object",
"single",
"search"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this value is not used.

"single"
]
},
"description": {
Expand Down
2 changes: 1 addition & 1 deletion generator/config/stage/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ arguments:
name: specification
type:
- expression
variadic: object
variadic: object # XXX: This should somehow allow explicit typings for { fieldName: 1|0 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type is "expression", because any expression is accepted to compute a value.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. For IDE integrations/user support it's still valuable to be able to say "while this can be an arbitrary document, frequently it will have keys that match document keys and values which are either 0 or 1"

Copy link
Member

@GromNaN GromNaN May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we need an additional type for the projection. Maybe an enum:

0: Exclude
1: Include

And this parameter accepts an union of ProjectEnum|expression

tests:
-
name: 'Include Specific Fields in Output Documents'
Expand Down