Skip to content
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

Field Arguments RFC/Spec #139

Merged
merged 41 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
16b5dd8
Field Arguments RFC/Spec
sordina May 6, 2024
7cfdb49
adding arguments to ObjectField
sordina May 8, 2024
195b3de
golden test updates
sordina May 8, 2024
3b1993b
Extended Query
sordina May 8, 2024
5d9c479
Giving an optional "truncated" argument to article titles
sordina May 8, 2024
3c39632
vec!
sordina May 8, 2024
2427d34
example of request
sordina May 8, 2024
ba8cb32
rfc
sordina May 9, 2024
56bf8fb
rfc updates
sordina May 9, 2024
00330e0
rfc update
sordina May 9, 2024
7ffdb6d
RFC updates
sordina May 9, 2024
31c81d8
limit test
sordina May 11, 2024
0d3a995
removing truncated argument
sordina May 13, 2024
7b4dcaf
removing truncated argument
sordina May 13, 2024
6b7562e
moving rfc
sordina May 14, 2024
65d9a42
updating optionality
sordina May 15, 2024
1823ca6
Updating test to allow fields with all nullable arguments, or omit field
sordina May 15, 2024
4481e8a
cleaning up test
sordina May 15, 2024
8336236
fixing lint errors
sordina May 16, 2024
4c3ad44
Updating RFC
sordina May 16, 2024
c21767d
Enforce required arguments, use functional style to read arguments ob…
paf31 May 16, 2024
49a4419
Adding arguments section to field-selection spec
sordina May 17, 2024
db0e876
setting arguments to non-required field arguments to null in ndc-test
sordina May 17, 2024
46ded83
lint error
sordina May 17, 2024
41518d9
Making inner option for arguments
sordina May 17, 2024
7036c49
#[serde(skip_serializing_if = "BTreeMap::is_empty", default)]
sordina May 21, 2024
ec562f5
simplifying arguments field, no optionals
sordina May 21, 2024
5779f24
updating RFC
sordina May 21, 2024
032d538
fixing default() warning
sordina May 21, 2024
4c65db8
spec doc updates
sordina May 21, 2024
293036c
Changing wording: `Literal argument `null` values may be used for nul…
sordina May 22, 2024
5ad8ab8
Merge branch 'main' into lyndon/field-arguments
sordina May 23, 2024
ea0fbba
Moving RFC to 0010 due to nested fields RFC being merged
sordina May 23, 2024
d71230a
Merge branch 'main' into lyndon/field-arguments
paf31 May 23, 2024
df45dfd
cargo fmt
paf31 May 23, 2024
f992c99
Spec and tutorial changes
paf31 May 23, 2024
4c54782
Fix some bugs in ndc-test and ndc-reference
paf31 May 23, 2024
5f4d50e
fixing tests
sordina May 24, 2024
0a46a4a
lint error
sordina May 24, 2024
8417517
Remove debugging code
paf31 May 24, 2024
6f2577f
fmt
paf31 May 24, 2024
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
5 changes: 5 additions & 0 deletions ndc-models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ pub struct ObjectField {
/// The type of this field
#[serde(rename = "type")]
pub r#type: Type,
/// The arguments available to the field - Matches implementation from CollectionInfo
#[serde(skip_serializing_if = "BTreeMap::is_empty", default)]
pub arguments: BTreeMap<String, ArgumentInfo>,
sordina marked this conversation as resolved.
Show resolved Hide resolved
}
// ANCHOR_END: ObjectField

Expand Down Expand Up @@ -478,6 +481,8 @@ pub enum Field {
/// by specifying fields to fetch here.
/// If omitted, the column data will be fetched in full.
fields: Option<NestedField>,
#[serde(skip_serializing_if = "BTreeMap::is_empty", default)]
arguments: BTreeMap<String, Argument>,
},
Relationship {
query: Box<Query>,
Expand Down
47 changes: 47 additions & 0 deletions ndc-models/tests/json_schema/mutation_request.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@
"type": "null"
}
]
},
"arguments": {
"type": "object",
paf31 marked this conversation as resolved.
Show resolved Hide resolved
"additionalProperties": {
"$ref": "#/definitions/Argument"
}
}
}
},
Expand Down Expand Up @@ -175,6 +181,47 @@
}
]
},
"Argument": {
"title": "Argument",
"oneOf": [
{
"description": "The argument is provided by reference to a variable",
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"variable"
]
},
"name": {
"type": "string"
}
}
},
{
"description": "The argument is provided as a literal value",
"type": "object",
"required": [
"type",
"value"
],
"properties": {
"type": {
"type": "string",
"enum": [
"literal"
]
},
"value": true
}
}
]
},
"Query": {
"title": "Query",
"type": "object",
Expand Down
88 changes: 47 additions & 41 deletions ndc-models/tests/json_schema/query_request.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@
"type": "null"
}
]
},
"arguments": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Argument"
}
}
}
},
Expand Down Expand Up @@ -291,6 +297,47 @@
}
]
},
"Argument": {
"title": "Argument",
"oneOf": [
{
"description": "The argument is provided by reference to a variable",
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"variable"
]
},
"name": {
"type": "string"
}
}
},
{
"description": "The argument is provided as a literal value",
"type": "object",
"required": [
"type",
"value"
],
"properties": {
"type": {
"type": "string",
"enum": [
"literal"
]
},
"value": true
}
}
]
},
"RelationshipArgument": {
"title": "Relationship Argument",
"oneOf": [
Expand Down Expand Up @@ -852,47 +899,6 @@
}
]
},
"Argument": {
"title": "Argument",
"oneOf": [
{
"description": "The argument is provided by reference to a variable",
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"variable"
]
},
"name": {
"type": "string"
}
}
},
{
"description": "The argument is provided as a literal value",
"type": "object",
"required": [
"type",
"value"
],
"properties": {
"type": {
"type": "string",
"enum": [
"literal"
]
},
"value": true
}
}
]
},
"Relationship": {
"title": "Relationship",
"type": "object",
Expand Down
55 changes: 31 additions & 24 deletions ndc-models/tests/json_schema/schema_response.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,37 @@
"$ref": "#/definitions/Type"
}
]
},
"arguments": {
"description": "The arguments available to the field - Matches implementation from CollectionInfo",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/ArgumentInfo"
}
}
}
},
"ArgumentInfo": {
"title": "Argument Info",
"type": "object",
"required": [
"type"
],
"properties": {
"description": {
"description": "Argument description",
"type": [
"string",
"null"
]
},
"type": {
"description": "The name of the type of this argument",
"allOf": [
{
"$ref": "#/definitions/Type"
}
]
}
}
},
Expand Down Expand Up @@ -680,30 +711,6 @@
}
}
},
"ArgumentInfo": {
"title": "Argument Info",
"type": "object",
"required": [
"type"
],
"properties": {
"description": {
"description": "Argument description",
"type": [
"string",
"null"
]
},
"type": {
"description": "The name of the type of this argument",
"allOf": [
{
"$ref": "#/definitions/Type"
}
]
}
}
},
"UniquenessConstraint": {
"title": "Uniqueness Constraint",
"type": "object",
Expand Down
Loading
Loading