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

Update Facility and FacilityCSharp to add support for datetime fields. #11

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<VersionPrefix>3.6.0</VersionPrefix>
<VersionPrefix>3.7.0</VersionPrefix>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down Expand Up @@ -33,8 +33,8 @@
</PropertyGroup>

<PropertyGroup>
<FacilityVersion>2.10.1</FacilityVersion>
<FacilityCSharpVersion>2.19.0</FacilityCSharpVersion>
<FacilityVersion>2.11.0</FacilityVersion>
<FacilityCSharpVersion>2.22.0</FacilityCSharpVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## 3.7.0

* Update Facility and FacilityCSharp to add support for `datetime` fields.

## 3.6.0

* Support `extern` data and enum types.
Expand Down
19 changes: 12 additions & 7 deletions conformance/ConformanceApi.fsd
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,13 @@ service ConformanceApi
int32: int32;
int64: int64;
decimal: decimal;

[validate]
enum: Answer;
[validate] enum: Answer;
datetime: datetime;
}:
{
}

[http(method: GET, path: "/checkPath/{string}/{boolean}/{double}/{int32}/{int64}/{decimal}/{enum}")]
[http(method: GET, path: "/checkPath/{string}/{boolean}/{double}/{int32}/{int64}/{decimal}/{enum}/{datetime}")]
method checkPath
{
string: string;
Expand All @@ -165,9 +164,8 @@ service ConformanceApi
int32: int32;
int64: int64;
decimal: decimal;

[validate]
enum: Answer;
[validate] enum: Answer;
datetime: datetime;
}:
{
}
Expand All @@ -182,6 +180,7 @@ service ConformanceApi
[http(from: header)] int64: int64;
[http(from: header)] decimal: decimal;
[http(from: header)] enum: Answer;
[http(from: header)] datetime: datetime;
}:
{
[http(from: header)] string: string;
Expand All @@ -191,6 +190,7 @@ service ConformanceApi
[http(from: header)] int64: int64;
[http(from: header)] decimal: decimal;
[http(from: header)] enum: Answer;
[http(from: header)] datetime: datetime;
}

[http(path: "/mixed/{path}")]
Expand Down Expand Up @@ -261,6 +261,7 @@ service ConformanceApi
int32: int32;
int64: int64;
decimal: decimal;
datetime: datetime;
bytes: bytes;
object: object;
error: error;
Expand All @@ -280,6 +281,7 @@ service ConformanceApi
int32: int32[];
int64: int64[];
decimal: decimal[];
datetime: datetime[];
bytes: bytes[];
object: object[];
error: error[];
Expand All @@ -299,6 +301,7 @@ service ConformanceApi
int32: map<int32>;
int64: map<int64>;
decimal: map<decimal>;
datetime: map<datetime>;
bytes: map<bytes>;
object: map<object>;
error: map<error>;
Expand All @@ -318,6 +321,7 @@ service ConformanceApi
int32: result<int32>;
int64: result<int64>;
decimal: result<decimal>;
datetime: result<datetime>;
bytes: result<bytes>;
object: result<object>;
error: result<error>;
Expand All @@ -337,6 +341,7 @@ service ConformanceApi
int32: nullable<int32>;
int64: nullable<int64>;
decimal: nullable<decimal>;
datetime: nullable<datetime>;
bytes: nullable<bytes>;
object: nullable<object>;
error: nullable<error>;
Expand Down
46 changes: 34 additions & 12 deletions conformance/ConformanceTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"int32": 42,
"int64": 12345678910,
"decimal": 1.5,
"enum": "yes"
"enum": "yes",
"datetime": "2001-02-03T04:05:06Z"
},
"response": {}
},
Expand All @@ -24,7 +25,8 @@
"int32": 42,
"int64": 12345678910,
"decimal": 1.5,
"enum": "yes"
"enum": "yes",
"datetime": "2001-02-03T04:05:06Z"
},
"response": {}
},
Expand Down Expand Up @@ -205,6 +207,7 @@
"int32": [42, 24],
"int64": [12345678910, -987654321],
"decimal": [1.5, 6.875],
"datetime": ["2001-02-03T04:05:06Z", "2023-08-10T19:41:21Z"],
"bytes": ["aGk=", ""],
"object": [{ "": null, " ": [null] }, {}],
"error": [{ "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } }],
Expand All @@ -227,6 +230,7 @@
"int32": [42, 24],
"int64": [12345678910, -987654321],
"decimal": [1.5, 6.875],
"datetime": ["2001-02-03T04:05:06Z", "2023-08-10T19:41:21Z"],
"bytes": ["aGk=", ""],
"object": [{ "": null, " ": [null] }, {}],
"error": [{ "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } }],
Expand All @@ -252,6 +256,7 @@
"int32": 42,
"int64": 12345678910,
"decimal": 1.5,
"datetime": "2001-02-03T04:05:06Z",
"bytes": "aGk=",
"object": { "": null, " ": [null] },
"error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } },
Expand All @@ -267,6 +272,7 @@
"int32": 42,
"int64": 12345678910,
"decimal": 1.5,
"datetime": "2001-02-03T04:05:06Z",
"bytes": "aGk=",
"object": { "": null, " ": [null] },
"error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } },
Expand All @@ -285,7 +291,8 @@
"int32": 42,
"int64": 12345678910,
"decimal": 1.5,
"enum": "yes"
"enum": "yes",
"datetime": "2001-02-03T04:05:06Z"
},
"response": {
"string": "string",
Expand All @@ -294,7 +301,8 @@
"int32": 42,
"int64": 12345678910,
"decimal": 1.5,
"enum": "yes"
"enum": "yes",
"datetime": "2001-02-03T04:05:06Z"
}
},
{
Expand All @@ -315,6 +323,7 @@
"int32": { "": 42, " ": 24 },
"int64": { "": 12345678910, " ": -987654321 },
"decimal": { "": 1.5, " ": 6.875 },
"datetime": { "": "2001-02-03T04:05:06Z", " ": "2023-08-10T19:41:21Z" },
"bytes": { "": "aGk=", " ": "" },
"object": { "": { "": null, " ": [null] }, " ": {} },
"error": { "": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } }, " ": {} },
Expand All @@ -336,6 +345,7 @@
"int32": { "": 42, " ": 24 },
"int64": { "": 12345678910, " ": -987654321 },
"decimal": { "": 1.5, " ": 6.875 },
"datetime": { "": "2001-02-03T04:05:06Z", " ": "2023-08-10T19:41:21Z" },
"bytes": { "": "aGk=", " ": "" },
"object": { "": { "": null, " ": [null] }, " ": {} },
"error": { "": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } }, " ": {} },
Expand All @@ -361,6 +371,7 @@
"int32": 42,
"int64": 12345678910,
"decimal": 1.5,
"datetime": "2001-02-03T04:05:06Z",
"bytes": "aGk=",
"object": { "": null, " ": [null] },
"error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } },
Expand All @@ -381,6 +392,7 @@
"int32": 42,
"int64": 12345678910,
"decimal": 1.5,
"datetime": "2001-02-03T04:05:06Z",
"bytes": "aGk=",
"object": { "": null, " ": [null] },
"error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } },
Expand Down Expand Up @@ -421,6 +433,7 @@
"int32": null,
"int64": null,
"decimal": null,
"datetime": null,
"bytes": null,
"object": null,
"error": null,
Expand All @@ -441,6 +454,7 @@
"int32": null,
"int64": null,
"decimal": null,
"datetime": null,
"bytes": null,
"object": null,
"error": null,
Expand All @@ -465,6 +479,7 @@
"int32": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"int64": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"decimal": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"datetime": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"bytes": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"object": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"error": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
Expand All @@ -485,6 +500,7 @@
"int32": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"int64": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"decimal": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"datetime": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"bytes": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"object": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
"error": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
Expand All @@ -509,6 +525,7 @@
"int32": { "value": 42 },
"int64": { "value": 12345678910 },
"decimal": { "value": 1.5 },
"datetime": { "value": "2001-02-03T04:05:06Z" },
"bytes": { "value": "aGk=" },
"object": { "value": { "": null, " ": [null] } },
"error": { "value": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
Expand All @@ -530,6 +547,7 @@
"int32": { "value": 42 },
"int64": { "value": 12345678910 },
"decimal": { "value": 1.5 },
"datetime": { "value": "2001-02-03T04:05:06Z" },
"bytes": { "value": "aGk=" },
"object": { "value": { "": null, " ": [null] } },
"error": { "value": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
Expand Down Expand Up @@ -767,7 +785,7 @@
"method": "checkPath",
"httpRequest": {
"method": "GET",
"path": "/CHECKPATH/pathCase/true/1.5/3/4/0.625/yes"
"path": "/CHECKPATH/pathCase/true/1.5/3/4/0.625/yes/2001-02-03T04:05:06Z"
},
"request": {
"string": "pathCase",
Expand All @@ -776,7 +794,8 @@
"int32": 3,
"int64": 4,
"decimal": 0.625,
"enum": "yes"
"enum": "yes",
"datetime": "2001-02-03T04:05:06Z"
},
"response": {}
},
Expand All @@ -785,7 +804,7 @@
"method": "checkPath",
"httpRequest": {
"method": "GET",
"path": "/checkPath/booleanCase/TRUE/1.5/3/4/0.625/yes"
"path": "/checkPath/booleanCase/TRUE/1.5/3/4/0.625/yes/2001-02-03T04:05:06Z"
},
"request": {
"string": "booleanCase",
Expand All @@ -794,7 +813,8 @@
"int32": 3,
"int64": 4,
"decimal": 0.625,
"enum": "yes"
"enum": "yes",
"datetime": "2001-02-03T04:05:06Z"
},
"response": {}
},
Expand All @@ -803,7 +823,7 @@
"method": "checkQuery",
"httpRequest": {
"method": "GET",
"path": "/CHECKQUERY?string=pathCase&boolean=true&double=1.5&int32=3&int64=4&decimal=0.625&enum=yes"
"path": "/CHECKQUERY?string=pathCase&boolean=true&double=1.5&int32=3&int64=4&decimal=0.625&enum=yes&datetime=2001-02-03T04:05:06Z"
},
"request": {
"string": "pathCase",
Expand All @@ -812,7 +832,8 @@
"int32": 3,
"int64": 4,
"decimal": 0.625,
"enum": "yes"
"enum": "yes",
"datetime": "2001-02-03T04:05:06Z"
},
"response": {}
},
Expand All @@ -821,7 +842,7 @@
"method": "checkQuery",
"httpRequest": {
"method": "GET",
"path": "/checkQuery?STRING=queryCase&boolean=true&double=1.5&int32=3&int64=4&decimal=0.625&enum=yes"
"path": "/checkQuery?STRING=queryCase&boolean=true&double=1.5&int32=3&int64=4&decimal=0.625&enum=yes&datetime=2001-02-03T04:05:06Z"
},
"request": {
"string": "queryCase",
Expand All @@ -830,7 +851,8 @@
"int32": 3,
"int64": 4,
"decimal": 0.625,
"enum": "yes"
"enum": "yes",
"datetime": "2001-02-03T04:05:06Z"
},
"response": {}
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"facilityconformance": {
"version": "2.19.0",
"version": "2.22.0",
"commands": [
"FacilityConformance"
]
Expand Down
3 changes: 1 addition & 2 deletions src/Facility.AspNetCore/FacilityActionFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ public sealed class FacilityActionFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context)
{
if (context.ActionArguments.ContainsKey(c_httpRequestKey) &&
context.ActionArguments[c_httpRequestKey]!.GetType() == typeof(HttpRequestMessage))
if (context.ActionArguments.TryGetValue(c_httpRequestKey, out var request) && request?.GetType() == typeof(HttpRequestMessage))
{
context.ActionArguments[c_httpRequestKey] = FacilityAspNetCoreUtility.CreateHttpRequestMessage(context.HttpContext.Request);
}
Expand Down