Skip to content

Commit 4c3878f

Browse files
authored
Merge pull request #72 from ejball/float
2 parents 2e8c1f4 + ef558ef commit 4c3878f

12 files changed

+132
-15
lines changed

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionPrefix>3.1.0</VersionPrefix>
5-
<PackageValidationBaselineVersion>3.0.0</PackageValidationBaselineVersion>
4+
<VersionPrefix>3.2.0</VersionPrefix>
5+
<PackageValidationBaselineVersion>3.1.0</PackageValidationBaselineVersion>
66
<LangVersion>12.0</LangVersion>
77
<Nullable>enable</Nullable>
88
<ImplicitUsings>enable</ImplicitUsings>

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageVersion Include="Facility.CodeGen.Console" Version="2.15.0" />
7-
<PackageVersion Include="Facility.Definition" Version="2.15.0" />
6+
<PackageVersion Include="Facility.CodeGen.Console" Version="2.16.0" />
7+
<PackageVersion Include="Facility.Definition" Version="2.16.0" />
88
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
99
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
1010
<PackageVersion Include="NUnit" Version="4.1.0" />

ReleaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
These are the NuGet package releases. See also [npm Release Notes](ReleaseNotesNpm.md).
44

5+
## 3.2.0
6+
7+
* Support `float` field type.
8+
59
## 3.1.0
610

711
* Drop support for end-of-life frameworks.

conformance/ConformanceApi.fsd

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ service ConformanceApi
145145
{
146146
string: string;
147147
boolean: boolean;
148+
float: float;
148149
double: double;
149150
int32: int32;
150151
int64: int64;
@@ -155,11 +156,12 @@ service ConformanceApi
155156
{
156157
}
157158

158-
[http(method: GET, path: "/checkPath/{string}/{boolean}/{double}/{int32}/{int64}/{decimal}/{enum}/{datetime}")]
159+
[http(method: GET, path: "/checkPath/{string}/{boolean}/{float}/{double}/{int32}/{int64}/{decimal}/{enum}/{datetime}")]
159160
method checkPath
160161
{
161162
string: string;
162163
boolean: boolean;
164+
float: float;
163165
double: double;
164166
int32: int32;
165167
int64: int64;
@@ -175,6 +177,7 @@ service ConformanceApi
175177
{
176178
[http(from: header)] string: string;
177179
[http(from: header)] boolean: boolean;
180+
[http(from: header)] float: float;
178181
[http(from: header)] double: double;
179182
[http(from: header)] int32: int32;
180183
[http(from: header)] int64: int64;
@@ -185,6 +188,7 @@ service ConformanceApi
185188
{
186189
[http(from: header)] string: string;
187190
[http(from: header)] boolean: boolean;
191+
[http(from: header)] float: float;
188192
[http(from: header)] double: double;
189193
[http(from: header)] int32: int32;
190194
[http(from: header)] int64: int64;
@@ -266,6 +270,7 @@ service ConformanceApi
266270
{
267271
string: string;
268272
boolean: boolean;
273+
float: float;
269274
double: double;
270275
int32: int32;
271276
int64: int64;
@@ -286,6 +291,7 @@ service ConformanceApi
286291
{
287292
string: string[];
288293
boolean: boolean[];
294+
float: float[];
289295
double: double[];
290296
int32: int32[];
291297
int64: int64[];
@@ -306,6 +312,7 @@ service ConformanceApi
306312
{
307313
string: map<string>;
308314
boolean: map<boolean>;
315+
float: map<float>;
309316
double: map<double>;
310317
int32: map<int32>;
311318
int64: map<int64>;
@@ -326,6 +333,7 @@ service ConformanceApi
326333
{
327334
string: result<string>;
328335
boolean: result<boolean>;
336+
float: result<float>;
329337
double: result<double>;
330338
int32: result<int32>;
331339
int64: result<int64>;
@@ -346,6 +354,7 @@ service ConformanceApi
346354
{
347355
string: nullable<string>;
348356
boolean: nullable<boolean>;
357+
float: nullable<float>;
349358
double: nullable<double>;
350359
int32: nullable<int32>;
351360
int64: nullable<int64>;

conformance/ConformanceTests.json

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"request": {
77
"string": "string",
88
"boolean": true,
9+
"float": 0.1875,
910
"double": 0.375,
1011
"int32": 42,
1112
"int64": 12345678910,
@@ -21,6 +22,7 @@
2122
"request": {
2223
"string": "string",
2324
"boolean": true,
25+
"float": 0.1875,
2426
"double": 0.375,
2527
"int32": 42,
2628
"int64": 12345678910,
@@ -203,6 +205,7 @@
203205
"array": {
204206
"string": ["string", "\n"],
205207
"boolean": [true, false],
208+
"float": [0.1875, -0.75],
206209
"double": [0.375, -1.5],
207210
"int32": [42, 24],
208211
"int64": [12345678910, -987654321],
@@ -226,6 +229,7 @@
226229
"array": {
227230
"string": ["string", "\n"],
228231
"boolean": [true, false],
232+
"float": [0.1875, -0.75],
229233
"double": [0.375, -1.5],
230234
"int32": [42, 24],
231235
"int64": [12345678910, -987654321],
@@ -252,6 +256,7 @@
252256
"field": {
253257
"string": "string",
254258
"boolean": true,
259+
"float": 0.1875,
255260
"double": 0.375,
256261
"int32": 42,
257262
"int64": 12345678910,
@@ -268,6 +273,7 @@
268273
"field": {
269274
"string": "string",
270275
"boolean": true,
276+
"float": 0.1875,
271277
"double": 0.375,
272278
"int32": 42,
273279
"int64": 12345678910,
@@ -287,6 +293,7 @@
287293
"request": {
288294
"string": "string",
289295
"boolean": true,
296+
"float": 0.1875,
290297
"double": 0.375,
291298
"int32": 42,
292299
"int64": 12345678910,
@@ -297,6 +304,7 @@
297304
"response": {
298305
"string": "string",
299306
"boolean": true,
307+
"float": 0.1875,
300308
"double": 0.375,
301309
"int32": 42,
302310
"int64": 12345678910,
@@ -319,6 +327,7 @@
319327
"map": {
320328
"string": { "": "string", " ": "\n" },
321329
"boolean": { "": true, " ": false },
330+
"float": { "": 0.1875, " ": -0.75 },
322331
"double": { "": 0.375, " ": -1.5 },
323332
"int32": { "": 42, " ": 24 },
324333
"int64": { "": 12345678910, " ": -987654321 },
@@ -341,6 +350,7 @@
341350
"map": {
342351
"string": { "": "string", " ": "\n" },
343352
"boolean": { "": true, " ": false },
353+
"float": { "": 0.1875, " ": -0.75 },
344354
"double": { "": 0.375, " ": -1.5 },
345355
"int32": { "": 42, " ": 24 },
346356
"int64": { "": 12345678910, " ": -987654321 },
@@ -367,6 +377,7 @@
367377
"nullable": {
368378
"string": "string",
369379
"boolean": true,
380+
"float": 0.1875,
370381
"double": 0.375,
371382
"int32": 42,
372383
"int64": 12345678910,
@@ -388,6 +399,7 @@
388399
"nullable": {
389400
"string": "string",
390401
"boolean": true,
402+
"float": 0.1875,
391403
"double": 0.375,
392404
"int32": 42,
393405
"int64": 12345678910,
@@ -429,6 +441,7 @@
429441
"nullable": {
430442
"string": null,
431443
"boolean": null,
444+
"float": null,
432445
"double": null,
433446
"int32": null,
434447
"int64": null,
@@ -450,6 +463,7 @@
450463
"nullable": {
451464
"string": null,
452465
"boolean": null,
466+
"float": null,
453467
"double": null,
454468
"int32": null,
455469
"int64": null,
@@ -475,6 +489,7 @@
475489
"result": {
476490
"string": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
477491
"boolean": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
492+
"float": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
478493
"double": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
479494
"int32": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
480495
"int64": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
@@ -496,6 +511,7 @@
496511
"result": {
497512
"string": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
498513
"boolean": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
514+
"float": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
499515
"double": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
500516
"int32": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
501517
"int64": { "error": { "code": "code", "message": "message", "innerError": { "code": "code" }, "details": { "": null, " ": [null] } } },
@@ -521,6 +537,7 @@
521537
"result": {
522538
"string": { "value": "string" },
523539
"boolean": { "value": true },
540+
"float": { "value": 0.1875 },
524541
"double": { "value": 0.375 },
525542
"int32": { "value": 42 },
526543
"int64": { "value": 12345678910 },
@@ -543,6 +560,7 @@
543560
"result": {
544561
"string": { "value": "string" },
545562
"boolean": { "value": true },
563+
"float": { "value": 0.1875 },
546564
"double": { "value": 0.375 },
547565
"int32": { "value": 42 },
548566
"int64": { "value": 12345678910 },
@@ -785,11 +803,12 @@
785803
"method": "checkPath",
786804
"httpRequest": {
787805
"method": "GET",
788-
"path": "/CHECKPATH/pathCase/true/1.5/3/4/0.625/yes/2001-02-03T04:05:06Z"
806+
"path": "/CHECKPATH/pathCase/true/0.75/1.5/3/4/0.625/yes/2001-02-03T04:05:06Z"
789807
},
790808
"request": {
791809
"string": "pathCase",
792810
"boolean": true,
811+
"float": 0.75,
793812
"double": 1.5,
794813
"int32": 3,
795814
"int64": 4,
@@ -804,11 +823,12 @@
804823
"method": "checkPath",
805824
"httpRequest": {
806825
"method": "GET",
807-
"path": "/checkPath/booleanCase/TRUE/1.5/3/4/0.625/yes/2001-02-03T04:05:06Z"
826+
"path": "/checkPath/booleanCase/TRUE/0.75/1.5/3/4/0.625/yes/2001-02-03T04:05:06Z"
808827
},
809828
"request": {
810829
"string": "booleanCase",
811830
"boolean": true,
831+
"float": 0.75,
812832
"double": 1.5,
813833
"int32": 3,
814834
"int64": 4,
@@ -823,11 +843,12 @@
823843
"method": "checkQuery",
824844
"httpRequest": {
825845
"method": "GET",
826-
"path": "/CHECKQUERY?string=pathCase&boolean=true&double=1.5&int32=3&int64=4&decimal=0.625&enum=yes&datetime=2001-02-03T04:05:06Z"
846+
"path": "/CHECKQUERY?string=pathCase&boolean=true&float=0.75&double=1.5&int32=3&int64=4&decimal=0.625&enum=yes&datetime=2001-02-03T04:05:06Z"
827847
},
828848
"request": {
829849
"string": "pathCase",
830850
"boolean": true,
851+
"float": 0.75,
831852
"double": 1.5,
832853
"int32": 3,
833854
"int64": 4,
@@ -842,11 +863,12 @@
842863
"method": "checkQuery",
843864
"httpRequest": {
844865
"method": "GET",
845-
"path": "/checkQuery?STRING=queryCase&boolean=true&double=1.5&int32=3&int64=4&decimal=0.625&enum=yes&datetime=2001-02-03T04:05:06Z"
866+
"path": "/checkQuery?STRING=queryCase&boolean=true&float=0.75&double=1.5&int32=3&int64=4&decimal=0.625&enum=yes&datetime=2001-02-03T04:05:06Z"
846867
},
847868
"request": {
848869
"string": "queryCase",
849870
"boolean": true,
871+
"float": 0.75,
850872
"double": 1.5,
851873
"int32": 3,
852874
"int64": 4,

conformance/src/conformanceApi.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ class ConformanceApiHttpClient implements IConformanceApi {
254254
const query: string[] = [];
255255
request.string == null || query.push('string=' + encodeURIComponent(request.string));
256256
request.boolean == null || query.push('boolean=' + request.boolean.toString());
257+
request.float == null || query.push('float=' + encodeURIComponent(request.float.toString()));
257258
request.double == null || query.push('double=' + encodeURIComponent(request.double.toString()));
258259
request.int32 == null || query.push('int32=' + request.int32.toString());
259260
request.int64 == null || query.push('int64=' + request.int64.toString());
@@ -289,6 +290,10 @@ class ConformanceApiHttpClient implements IConformanceApi {
289290
if (!uriPartBoolean) {
290291
return Promise.resolve(createRequiredRequestFieldError('boolean'));
291292
}
293+
const uriPartFloat = request.float != null && encodeURIComponent(request.float.toString());
294+
if (!uriPartFloat) {
295+
return Promise.resolve(createRequiredRequestFieldError('float'));
296+
}
292297
const uriPartDouble = request.double != null && encodeURIComponent(request.double.toString());
293298
if (!uriPartDouble) {
294299
return Promise.resolve(createRequiredRequestFieldError('double'));
@@ -313,7 +318,7 @@ class ConformanceApiHttpClient implements IConformanceApi {
313318
if (!uriPartDatetime) {
314319
return Promise.resolve(createRequiredRequestFieldError('datetime'));
315320
}
316-
const uri = `checkPath/${uriPartString}/${uriPartBoolean}/${uriPartDouble}/${uriPartInt32}/${uriPartInt64}/${uriPartDecimal}/${uriPartEnum}/${uriPartDatetime}`;
321+
const uri = `checkPath/${uriPartString}/${uriPartBoolean}/${uriPartFloat}/${uriPartDouble}/${uriPartInt32}/${uriPartInt64}/${uriPartDecimal}/${uriPartEnum}/${uriPartDatetime}`;
317322
const fetchRequest: IFetchRequest = {
318323
method: 'GET',
319324
};
@@ -343,6 +348,9 @@ class ConformanceApiHttpClient implements IConformanceApi {
343348
if (request.boolean != null) {
344349
fetchRequest.headers!['boolean'] = request.boolean.toString();
345350
}
351+
if (request.float != null) {
352+
fetchRequest.headers!['float'] = request.float.toString();
353+
}
346354
if (request.double != null) {
347355
fetchRequest.headers!['double'] = request.double.toString();
348356
}
@@ -380,6 +388,10 @@ class ConformanceApiHttpClient implements IConformanceApi {
380388
if (headerValue != null) {
381389
value.boolean = parseBoolean(headerValue);
382390
}
391+
headerValue = result.response.headers.get('float');
392+
if (headerValue != null) {
393+
value.float = parseFloat(headerValue);
394+
}
383395
headerValue = result.response.headers.get('double');
384396
if (headerValue != null) {
385397
value.double = parseFloat(headerValue);

0 commit comments

Comments
 (0)