Add specified_by_url
for Tz & DateTime<Tz> & Url & Uuid scalars
This commit is contained in:
parent
057d6aebfd
commit
fa6b7964c4
6
src/types/external/chrono_tz.rs
vendored
6
src/types/external/chrono_tz.rs
vendored
|
@ -2,7 +2,11 @@ use chrono_tz::Tz;
|
|||
|
||||
use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value};
|
||||
|
||||
#[Scalar(internal, name = "TimeZone")]
|
||||
#[Scalar(
|
||||
internal,
|
||||
name = "TimeZone",
|
||||
specified_by_url = "http://www.iana.org/time-zones"
|
||||
)]
|
||||
impl ScalarType for Tz {
|
||||
fn parse(value: Value) -> InputValueResult<Self> {
|
||||
match value {
|
||||
|
|
18
src/types/external/datetime.rs
vendored
18
src/types/external/datetime.rs
vendored
|
@ -5,7 +5,11 @@ use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value};
|
|||
/// Implement the DateTime<FixedOffset> scalar
|
||||
///
|
||||
/// The input/output is a string in RFC3339 format.
|
||||
#[Scalar(internal, name = "DateTime")]
|
||||
#[Scalar(
|
||||
internal,
|
||||
name = "DateTime",
|
||||
specified_by_url = "https://datatracker.ietf.org/doc/html/rfc3339"
|
||||
)]
|
||||
impl ScalarType for DateTime<FixedOffset> {
|
||||
fn parse(value: Value) -> InputValueResult<Self> {
|
||||
match &value {
|
||||
|
@ -22,7 +26,11 @@ impl ScalarType for DateTime<FixedOffset> {
|
|||
/// Implement the DateTime<Local> scalar
|
||||
///
|
||||
/// The input/output is a string in RFC3339 format.
|
||||
#[Scalar(internal, name = "DateTime")]
|
||||
#[Scalar(
|
||||
internal,
|
||||
name = "DateTime",
|
||||
specified_by_url = "https://datatracker.ietf.org/doc/html/rfc3339"
|
||||
)]
|
||||
impl ScalarType for DateTime<Local> {
|
||||
fn parse(value: Value) -> InputValueResult<Self> {
|
||||
match &value {
|
||||
|
@ -39,7 +47,11 @@ impl ScalarType for DateTime<Local> {
|
|||
/// Implement the DateTime<Utc> scalar
|
||||
///
|
||||
/// The input/output is a string in RFC3339 format.
|
||||
#[Scalar(internal, name = "DateTime")]
|
||||
#[Scalar(
|
||||
internal,
|
||||
name = "DateTime",
|
||||
specified_by_url = "https://datatracker.ietf.org/doc/html/rfc3339"
|
||||
)]
|
||||
impl ScalarType for DateTime<Utc> {
|
||||
fn parse(value: Value) -> InputValueResult<Self> {
|
||||
match &value {
|
||||
|
|
2
src/types/external/url.rs
vendored
2
src/types/external/url.rs
vendored
|
@ -2,7 +2,7 @@ use url::Url;
|
|||
|
||||
use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value};
|
||||
|
||||
#[Scalar(internal)]
|
||||
#[Scalar(internal, specified_by_url = "http://url.spec.whatwg.org/")]
|
||||
/// URL is a String implementing the [URL Standard](http://url.spec.whatwg.org/)
|
||||
impl ScalarType for Url {
|
||||
fn parse(value: Value) -> InputValueResult<Self> {
|
||||
|
|
6
src/types/external/uuid.rs
vendored
6
src/types/external/uuid.rs
vendored
|
@ -2,7 +2,11 @@ use uuid::Uuid;
|
|||
|
||||
use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value};
|
||||
|
||||
#[Scalar(internal, name = "UUID")]
|
||||
#[Scalar(
|
||||
internal,
|
||||
name = "UUID",
|
||||
specified_by_url = "http://tools.ietf.org/html/rfc4122"
|
||||
)]
|
||||
/// A UUID is a unique 128-bit number, stored as 16 octets. UUIDs are parsed as Strings
|
||||
/// within GraphQL. UUIDs are used to assign unique identifiers to entities without requiring a central
|
||||
/// allocating authority.
|
||||
|
|
Loading…
Reference in New Issue
Block a user