Skip to content

Commit f957605

Browse files
authored
Merge pull request #46 from ejball/custom-http
2 parents fcb02e4 + 87fda98 commit f957605

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

Diff for: Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionPrefix>2.11.0</VersionPrefix>
4+
<VersionPrefix>2.12.0</VersionPrefix>
55
<PackageValidationBaselineVersion>2.10.1</PackageValidationBaselineVersion>
66
<LangVersion>12.0</LangVersion>
77
<Nullable>enable</Nullable>

Diff for: ReleaseNotes.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## 2.12.0
4+
5+
* Support `[http(from: custom)]` on request/response fields.
6+
37
## 2.11.0
48

59
* Add support for `datetime`.

Diff for: src/Facility.Definition/Http/HttpMethodInfo.cs

+6
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ internal HttpMethodInfo(ServiceMethodInfo methodInfo, ServiceInfo serviceInfo)
146146
AddValidationError(new ServiceDefinitionError("Type not supported by header request field.", requestField.Position));
147147
requestHeaderFields.Add(new HttpHeaderFieldInfo(requestField));
148148
}
149+
else if (from == "custom")
150+
{
151+
}
149152
else if (from is not null)
150153
{
151154
AddValidationError(new ServiceDefinitionError($"Unsupported 'from' parameter of 'http' attribute: '{from}'", requestField.Position));
@@ -208,6 +211,9 @@ internal HttpMethodInfo(ServiceMethodInfo methodInfo, ServiceInfo serviceInfo)
208211
responseNormalFields.Add(new HttpNormalFieldInfo(responseField));
209212
break;
210213

214+
case "custom":
215+
break;
216+
211217
default:
212218
AddValidationError(new ServiceDefinitionError($"Unsupported 'from' parameter of 'http' attribute: '{from}'", responseField.Position));
213219
break;

Diff for: tests/Facility.Definition.UnitTests/Http/HttpMethodInfoTests.cs

+14
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,20 @@ public void NamedHeaderResponseField()
560560
method.ResponseHeaderFields.Single().Name.Should().Be("Our-Xyzzy");
561561
}
562562

563+
[Test]
564+
public void RequestFieldCustomFrom()
565+
{
566+
var method = ParseHttpApi("service TestApi { method do { [http(from: custom)] xyzzy: string; }: {} }").Methods.Single();
567+
method.RequestNormalFields.Should().BeEmpty();
568+
}
569+
570+
[Test]
571+
public void ResponseFieldCustomFrom()
572+
{
573+
var method = ParseHttpApi("service TestApi { method do {}: { [http(from: custom)] xyzzy: string; } }").Methods.Single();
574+
method.ValidResponses.Single().NormalFields.Should().BeEmpty();
575+
}
576+
563577
[Test]
564578
public void RequestHeaderFieldBadParameter()
565579
{

0 commit comments

Comments
 (0)