Skip to content
Merged
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
4 changes: 3 additions & 1 deletion dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ accessibilities
agrc
Alderaan
Andi
andimarek
ASPDEPR004
ASPDEPR008
aspnetcore
Expand All @@ -19,6 +18,7 @@ bananacakepop
bbox
BCPROCKS
bfnrt
birthdates
blazor
blazorwasm
Brontie
Expand Down Expand Up @@ -52,12 +52,14 @@ EPSG
esque
evolvability
Fanout
FFFFFFFZ
fffzzz
fieldset
FIPS
foos
fricking
frontends
Fzzz
GEOGCS
Giroux
GraphiQL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,13 @@ private static bool TryGetJsonSchemaFormat(

format = scalarType.SpecifiedBy?.OriginalString switch
{
"https://scalars.graphql.org/andimarek/date-time.html" => Formats.DateTime,
"https://scalars.graphql.org/andimarek/local-date.html" => Formats.Date,
"https://scalars.graphql.org/chillicream/date.html" => Formats.Date,
Comment thread
glen-84 marked this conversation as resolved.
"https://scalars.graphql.org/chillicream/date-time.html" => Formats.DateTime,
"https://scalars.graphql.org/chillicream/local-date.html" => Formats.Date,
"https://scalars.graphql.org/chillicream/time-span.html" => Formats.Duration,
"https://scalars.graphql.org/chillicream/uuid.html" => Formats.Uuid,
"https://scalars.graphql.org/chillicream/uri.html" => Formats.Uri,
"https://scalars.graphql.org/chillicream/url.html" => Formats.Uri,
_ => null
};

Expand All @@ -201,10 +206,22 @@ private static bool TryGetJsonSchemaPattern(

pattern = scalarType.SpecifiedBy?.OriginalString switch
{
"https://scalars.graphql.org/andimarek/date-time.html"
=> @"^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d{1,7})?(?:[Zz]|[+-]\d{2}:\d{2})$",
"https://scalars.graphql.org/andimarek/local-date.html"
"https://scalars.graphql.org/chillicream/base64-string.html"
=> @"^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$",
"https://scalars.graphql.org/chillicream/date.html"
=> @"^\d{4}-\d{2}-\d{2}$",
"https://scalars.graphql.org/chillicream/date-time.html"
=> @"^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:[Zz]|[+-]\d{2}:\d{2})$",
"https://scalars.graphql.org/chillicream/local-date.html"
=> @"^\d{4}-\d{2}-\d{2}$",
"https://scalars.graphql.org/chillicream/local-date-time.html"
=> @"^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?$",
"https://scalars.graphql.org/chillicream/local-time.html"
=> @"^\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?$",
"https://scalars.graphql.org/chillicream/time-span.html"
=> @"^-?P(?:\d+W|(?=\d|T(?:\d|$))(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?)?)$",
"https://scalars.graphql.org/chillicream/uuid.html"
=> @"^[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}$",
_ => null
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,13 @@ private static OpenApiSchema CreateScalarSchema(IScalarTypeDefinition scalarType
{
var format = scalarType.SpecifiedBy?.OriginalString switch
{
"https://scalars.graphql.org/andimarek/date-time.html" => "date-time",
"https://scalars.graphql.org/andimarek/local-date.html" => "date",
"https://scalars.graphql.org/chillicream/date.html" => "date",
"https://scalars.graphql.org/chillicream/date-time.html" => "date-time",
"https://scalars.graphql.org/chillicream/local-date.html" => "date",
"https://scalars.graphql.org/chillicream/time-span.html" => "duration",
"https://scalars.graphql.org/chillicream/uuid.html" => "uuid",
"https://scalars.graphql.org/chillicream/uri.html" => "uri",
"https://scalars.graphql.org/chillicream/url.html" => "uri",
_ => null
};

Expand All @@ -550,10 +555,22 @@ private static OpenApiSchema CreateScalarSchema(IScalarTypeDefinition scalarType
{
var pattern = scalarType.SpecifiedBy?.OriginalString switch
{
"https://scalars.graphql.org/andimarek/date-time.html"
=> @"^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d{1,7})?(?:[Zz]|[+-]\d{2}:\d{2})$",
"https://scalars.graphql.org/andimarek/local-date.html"
"https://scalars.graphql.org/chillicream/base64-string.html"
=> @"^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$",
"https://scalars.graphql.org/chillicream/date.html"
=> @"^\d{4}-\d{2}-\d{2}$",
"https://scalars.graphql.org/chillicream/date-time.html"
=> @"^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:[Zz]|[+-]\d{2}:\d{2})$",
"https://scalars.graphql.org/chillicream/local-date.html"
=> @"^\d{4}-\d{2}-\d{2}$",
"https://scalars.graphql.org/chillicream/local-date-time.html"
=> @"^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?$",
"https://scalars.graphql.org/chillicream/local-time.html"
=> @"^\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?$",
"https://scalars.graphql.org/chillicream/time-span.html"
=> @"^-?P(?:\d+W|(?=\d|T(?:\d|$))(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?)?)$",
"https://scalars.graphql.org/chillicream/uuid.html"
=> @"^[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}$",
_ => null
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public void ToJsonSchemaBuilder_ValidValues_MatchPattern(Type type, string value
[InlineData(typeof(DateTimeType), "2011-08-30")]
// Seconds are not allowed for the offset.
[InlineData(typeof(DateTimeType), "2011-08-30T13:22:53.108+03:30:15")]
// A DateTime with 8 fractional digits.
[InlineData(typeof(DateTimeType), "2011-08-30T13:22:53.12345678+03:30")]
// A DateTime with 10 fractional digits.
[InlineData(typeof(DateTimeType), "2011-08-30T13:22:53.1234567890+03:30")]
[InlineData(typeof(LocalDateTimeType), "2018/06/11T08:46:14 pm")]
[InlineData(typeof(LocalDateTimeType), "abc")]
[InlineData(typeof(LocalTimeType), "08:46:14 pm")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"boolean": true,
"byte": 1,
"date": "2000-01-01",
"dateTime": "2000-01-01T12:00:00.000Z",
"dateTime": "2000-01-01T12:00:00Z",
"decimal": 79228162514264337593543950335,
"enum": "VALUE1",
"float": 1.5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"boolean": true,
"byte": 1,
"date": "2000-01-01",
"dateTime": "2000-01-01T12:00:00.000Z",
"dateTime": "2000-01-01T12:00:00Z",
"decimal": 79228162514264337593543950335,
"enum": "VALUE1",
"float": 1.5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"string",
"null"
],
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description",
"default": "12:00:00"
}
Expand Down Expand Up @@ -76,7 +76,7 @@
"string",
"null"
],
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description",
"default": "12:00:00"
}
Expand Down Expand Up @@ -157,7 +157,7 @@
"string",
"null"
],
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description",
"default": "12:00:00"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"string",
"null"
],
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description"
}
},
Expand Down Expand Up @@ -69,7 +69,7 @@
"string",
"null"
],
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description"
}
},
Expand Down Expand Up @@ -130,7 +130,7 @@
"string",
"null"
],
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
},
"date": {
"type": "string",
"format": "date",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"description": "Date description",
"default": "2000-01-01"
},
"dateTime": {
"type": "string",
"format": "date-time",
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,7})?(?:[Zz]|[+-]\\d{2}:\\d{2})$",
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:[Zz]|[+-]\\d{2}:\\d{2})$",
"description": "DateTime description",
"default": "2000-01-01T12:00:00Z"
},
Expand Down Expand Up @@ -95,13 +96,13 @@
},
"localDateTime": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "LocalDateTime description",
"default": "2000-01-01T12:00:00"
},
"localTime": {
"type": "string",
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "LocalTime description",
"default": "12:00:00"
},
Expand All @@ -121,7 +122,7 @@
"properties": {
"field1C": {
"type": "string",
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description",
"default": "12:00:00"
}
Expand Down Expand Up @@ -164,6 +165,7 @@
},
"timeSpan": {
"type": "string",
"format": "duration",
"pattern": "^-?P(?:\\d+W|(?=\\d|T(?:\\d|$))(?:\\d+Y)?(?:\\d+M)?(?:\\d+D)?(?:T(?:\\d+H)?(?:\\d+M)?(?:\\d+(?:\\.\\d+)?S)?)?)$",
"description": "TimeSpan description",
"default": "PT5M"
Expand All @@ -175,16 +177,19 @@
},
"uri": {
"type": "string",
"format": "uri",
"description": "URI description",
"default": "https://example.com"
},
"url": {
"type": "string",
"format": "uri",
"description": "URL description",
"default": "https://example.com"
},
"uuid": {
"type": "string",
"format": "uuid",
"pattern": "^[\\da-fA-F]{8}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{12}$",
"description": "UUID description",
"default": "00000000-0000-0000-0000-000000000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@
},
"date": {
"type": "string",
"format": "date",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"dateTime": {
"type": "string",
"format": "date-time",
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,7})?(?:[Zz]|[+-]\\d{2}:\\d{2})$"
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:[Zz]|[+-]\\d{2}:\\d{2})$"
},
"decimal": {
"type": "number"
Expand Down Expand Up @@ -74,11 +75,11 @@
},
"localDateTime": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$"
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$"
},
"localTime": {
"type": "string",
"pattern": "^\\d{2}:\\d{2}:\\d{2}$"
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$"
},
"long": {
"type": "integer"
Expand All @@ -94,7 +95,7 @@
"properties": {
"field1C": {
"type": "string",
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description"
}
},
Expand Down Expand Up @@ -125,19 +126,23 @@
},
"timeSpan": {
"type": "string",
"format": "duration",
"pattern": "^-?P(?:\\d+W|(?=\\d|T(?:\\d|$))(?:\\d+Y)?(?:\\d+M)?(?:\\d+D)?(?:T(?:\\d+H)?(?:\\d+M)?(?:\\d+(?:\\.\\d+)?S)?)?)$"
},
"unknown": {
"type": "string"
},
"uri": {
"type": "string"
"type": "string",
"format": "uri"
},
"url": {
"type": "string"
"type": "string",
"format": "uri"
},
"uuid": {
"type": "string",
"format": "uuid",
"pattern": "^[\\da-fA-F]{8}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{12}$"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
},
"date": {
"type": "string",
"format": "date",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"description": "Date description"
},
"dateTime": {
"type": "string",
"format": "date-time",
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,7})?(?:[Zz]|[+-]\\d{2}:\\d{2})$",
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?(?:[Zz]|[+-]\\d{2}:\\d{2})$",
"description": "DateTime description"
},
"decimal": {
Expand Down Expand Up @@ -78,12 +79,12 @@
},
"localDateTime": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "LocalDateTime description"
},
"localTime": {
"type": "string",
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "LocalTime description"
},
"long": {
Expand All @@ -101,7 +102,7 @@
"properties": {
"field1C": {
"type": "string",
"pattern": "^\\d{2}:\\d{2}:\\d{2}$",
"pattern": "^\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,9})?$",
"description": "field1C description"
}
},
Expand Down Expand Up @@ -132,6 +133,7 @@
},
"timeSpan": {
"type": "string",
"format": "duration",
"pattern": "^-?P(?:\\d+W|(?=\\d|T(?:\\d|$))(?:\\d+Y)?(?:\\d+M)?(?:\\d+D)?(?:T(?:\\d+H)?(?:\\d+M)?(?:\\d+(?:\\.\\d+)?S)?)?)$",
"description": "TimeSpan description"
},
Expand All @@ -141,14 +143,17 @@
},
"uri": {
"type": "string",
"format": "uri",
"description": "URI description"
},
"url": {
"type": "string",
"format": "uri",
"description": "URL description"
},
"uuid": {
"type": "string",
"format": "uuid",
"pattern": "^[\\da-fA-F]{8}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{4}-[\\da-fA-F]{12}$",
"description": "UUID description"
}
Expand Down
Loading
Loading