-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved support for built-in types and directives.
- Loading branch information
Showing
17 changed files
with
212 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use vergen::vergen; | ||
use vergen::{Config, ShaKind, TimestampKind}; | ||
|
||
pub fn main() { | ||
let mut config = Config::default(); | ||
*config.git_mut().sha_kind_mut() = ShaKind::Short; | ||
*config.git_mut().commit_timestamp_kind_mut() = TimestampKind::DateOnly; | ||
|
||
vergen(config).unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
pub const fn builtins() -> &'static [(&'static str, &'static str)] { | ||
&[ | ||
( | ||
"litho://std.litho.dev/directives.graphql", | ||
include_str!("../std/directives.graphql"), | ||
), | ||
( | ||
"litho://std.litho.dev/introspection.graphql", | ||
include_str!("../std/introspection.graphql"), | ||
), | ||
( | ||
"litho://std.litho.dev/litho.graphql", | ||
include_str!("../std/litho.graphql"), | ||
), | ||
( | ||
"litho://std.litho.dev/scalars.graphql", | ||
include_str!("../std/scalars.graphql"), | ||
), | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
mod builtins; | ||
mod compiler; | ||
mod dependency; | ||
mod depgraph; | ||
|
||
pub use builtins::builtins; | ||
pub use compiler::Compiler; | ||
pub use dependency::{Consumer, Dependency, Producer}; | ||
pub use depgraph::DepGraph; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
The `@skip` built-in directive may be provided for fields, fragment spreads, and | ||
inline fragments, and allows for conditional exclusion as described by the `if` | ||
argument. | ||
""" | ||
directive @skip( | ||
if: Boolean!, | ||
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
""" | ||
The `@include` built-in directive may be provided for fields, fragment spreads, | ||
and inline fragments, and allows for conditional inclusion during execution as | ||
described by the `if` argument. | ||
""" | ||
directive @include( | ||
if: Boolean!, | ||
) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
""" | ||
The `@deprecated` built-in directive is used within the type system definition | ||
language to indicate deprecated portions of a GraphQL service's schema, such as | ||
deprecated fields on a type or deprecated enum values. | ||
Deprecations include a reason for why it is deprecated, which is formatted using | ||
Markdown syntax (as specified by CommonMark). | ||
""" | ||
directive @deprecated( | ||
reason: String = "No longer supported", | ||
) on | ||
| FIELD_DEFINITION | ||
| ARGUMENT_DEFINITION | ||
| INPUT_FIELD_DEFINITION | ||
| ENUM_VALUE | ||
|
||
""" | ||
The `@specifiedBy` built-in directive is used within the type system definition | ||
language to provide a scalar specification URL for specifying the behavior of | ||
custom scalar types. The URL should point to a human-readable specification of | ||
the data format, serialization, and coercion rules. It must not appear on | ||
built-in scalar types. | ||
""" | ||
directive @specifiedBy( | ||
url: String!, | ||
) on SCALAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
extend type Query { | ||
__schema: __Schema! | ||
__type( | ||
name: String!, | ||
): __Type | ||
} | ||
|
||
type __Schema { | ||
description: String | ||
types: [__Type!]! | ||
queryType: __Type! | ||
mutationType: __Type | ||
subscriptionType: __Type | ||
directives: [__Directive!]! | ||
} | ||
|
||
type __Type { | ||
kind: __TypeKind | ||
name: String | ||
description: String | ||
fields( | ||
includeDeprecated: Boolean = false, | ||
): [__Field!] | ||
interfaces: [__Type!] | ||
possibleTypes: [__Type!] | ||
enumValues( | ||
includeDeprecated: Boolean = false, | ||
): [__EnumValue!] | ||
inputFields: [__InputValue!] | ||
ofType: __Type | ||
specifiedByURL: String | ||
} | ||
|
||
enum __TypeKind { | ||
SCALAR | ||
OBJECT | ||
INTERFACE | ||
UNION | ||
ENUM | ||
INPUT_OBJECT | ||
LIST | ||
NON_NULL | ||
} | ||
|
||
type __Field { | ||
name: String! | ||
description: String | ||
args: [__InputValue!]! | ||
type: __Type! | ||
isDeprecated: Boolean! | ||
deprecationReason: String | ||
} | ||
|
||
type __InputValue { | ||
name: String! | ||
description: String | ||
type: __Type! | ||
defaultValue: String | ||
} | ||
|
||
type __EnumValue { | ||
name: String! | ||
description: String | ||
isDeprecated: Boolean! | ||
deprecationReason: String | ||
} | ||
|
||
type __Directive { | ||
name: String! | ||
description: String | ||
locations: [__DirectiveLocation!]! | ||
args: [__InputValue!]! | ||
isRepeatable: Boolean! | ||
} | ||
|
||
enum __DirectiveLocation { | ||
QUERY | ||
MUTATION | ||
SUBSCRIPTION | ||
FIELD | ||
FRAGMENT_DEFINITION | ||
FRAGMENT_SPREAD | ||
INLINE_FRAGMENT | ||
VARIABLE_DEFINITION | ||
SCHEMA | ||
SCALAR | ||
OBJECT | ||
FIELD_DEFINITION | ||
ARGUMENT_DEFINITION | ||
INTERFACE | ||
UNION | ||
ENUM | ||
ENUM_VALUE | ||
INPUT_OBJECT | ||
INPUT_FIELD_DEFINITION | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
directive @litho( | ||
url: String!, | ||
) on SCHEMA |
2 changes: 0 additions & 2 deletions
2
litho-cli/std/scalars.graphql → litho-compiler/std/scalars.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.