Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9113fd

Browse files
committed
Support decimal.
1 parent 307e163 commit f9113fd

File tree

11 files changed

+34
-14
lines changed

11 files changed

+34
-14
lines changed

SolutionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Reflection;
22

3-
[assembly: AssemblyVersion("1.0.0.0")]
3+
[assembly: AssemblyVersion("1.1.0.0")]
44
[assembly: AssemblyCompany("")]
55
[assembly: AssemblyCopyright("Copyright 2016-2017 Ed Ball")]
66
[assembly: AssemblyTrademark("")]

example/ExampleApi.fsd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ service ExampleApi
2323
/// The maximum weight.
2424
[obsolete]
2525
maxWeight: double;
26+
27+
/// The minimum price.
28+
minPrice: decimal;
2629
}:
2730
{
2831
/// The widgets.
@@ -211,6 +214,9 @@ service ExampleApi
211214
/// The weight of the widget.
212215
[obsolete]
213216
weight: double;
217+
218+
/// The price of the widget.
219+
price: decimal;
214220
}
215221

216222
/// A widget job.
@@ -260,6 +266,10 @@ service ExampleApi
260266

261267
bigIntegers: int64[];
262268

269+
decimal: decimal;
270+
271+
decimals: decimal[];
272+
263273
error: error;
264274

265275
errors: error[];
@@ -307,7 +317,7 @@ service ExampleApi
307317

308318
crazy: result<map<string[]>[]>[];
309319

310-
[obsolete]
320+
[obsolete(message: "This field was never used.")]
311321
oldField: string;
312322
}
313323
}

example/js/exampleApi.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ExampleApiHttpClient {
3333
request.sort == null || query.push('sort=' + request.sort);
3434
request.desc == null || query.push('desc=' + request.desc.toString());
3535
request.maxWeight == null || query.push('maxWeight=' + encodeURIComponent(request.maxWeight.toString()));
36+
request.minPrice == null || query.push('minPrice=' + request.minPrice.toString());
3637
if (query.length) {
3738
uri = uri + '?' + query.join('&');
3839
}

example/ts/exampleApi.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export interface IGetWidgetsRequest {
4646
desc?: boolean;
4747
/** The maximum weight. */
4848
maxWeight?: number;
49+
/** The minimum price. */
50+
minPrice?: number;
4951
}
5052

5153
/** Response for GetWidgets. */
@@ -200,6 +202,8 @@ export interface IWidget {
200202
name?: string;
201203
/** The weight of the widget. */
202204
weight?: number;
205+
/** The price of the widget. */
206+
price?: number;
203207
}
204208

205209
/** A widget job. */
@@ -228,6 +232,8 @@ export interface IPreference {
228232
results?: IServiceResult<IWidget>[];
229233
bigInteger?: number;
230234
bigIntegers?: number[];
235+
decimal?: number;
236+
decimals?: number[];
231237
error?: IServiceError;
232238
errors?: IServiceError[];
233239
object?: { [name: string]: any };
@@ -274,6 +280,7 @@ class ExampleApiHttpClient implements IExampleApi {
274280
request.sort == null || query.push('sort=' + request.sort);
275281
request.desc == null || query.push('desc=' + request.desc.toString());
276282
request.maxWeight == null || query.push('maxWeight=' + encodeURIComponent(request.maxWeight.toString()));
283+
request.minPrice == null || query.push('minPrice=' + request.minPrice.toString());
277284
if (query.length) {
278285
uri = uri + '?' + query.join('&');
279286
}

src/Facility.CodeGen.JavaScript/Facility.CodeGen.JavaScript.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
<Compile Include="Properties\AssemblyInfo.cs" />
4747
</ItemGroup>
4848
<ItemGroup>
49-
<Reference Include="Facility.Definition, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
50-
<HintPath>..\..\packages\Facility.Definition.1.0.0\lib\portable-net45+netcore45+wpa81\Facility.Definition.dll</HintPath>
49+
<Reference Include="Facility.Definition, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
50+
<HintPath>..\..\packages\Facility.Definition.1.2.0\lib\portable-net45+netcore45+wpa81\Facility.Definition.dll</HintPath>
5151
<Private>True</Private>
5252
</Reference>
5353
<Reference Include="Faithlife.Parsing, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">

src/Facility.CodeGen.JavaScript/JavaScriptGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ private string RenderFieldType(ServiceTypeInfo fieldType)
285285
case ServiceTypeKind.Double:
286286
case ServiceTypeKind.Int32:
287287
case ServiceTypeKind.Int64:
288+
case ServiceTypeKind.Decimal:
288289
return "number";
289290
case ServiceTypeKind.Object:
290291
return "{ [name: string]: any }";
@@ -318,6 +319,7 @@ private string RenderUriComponent(ServiceFieldInfo field, ServiceInfo service)
318319
case ServiceTypeKind.Boolean:
319320
case ServiceTypeKind.Int32:
320321
case ServiceTypeKind.Int64:
322+
case ServiceTypeKind.Decimal:
321323
return $"request.{fieldName}.toString()";
322324
case ServiceTypeKind.Double:
323325
return $"encodeURIComponent(request.{fieldName}.toString())";

src/Facility.CodeGen.JavaScript/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Facility.Definition" version="1.0.0" targetFramework="portable45-net45+win8+wpa81" />
3+
<package id="Facility.Definition" version="1.2.0" targetFramework="portable45-net45+win8+wpa81" />
44
<package id="Faithlife.Parsing" version="1.0.1" targetFramework="portable45-net45+win8+wpa81" />
55
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="portable45-net45+win8+wpa81" />
66
<package id="YamlDotNet" version="4.0.0" targetFramework="portable45-net45+win8+wpa81" />

src/fsdgenjs/fsdgenjs.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
<HintPath>..\..\packages\ArgsReading.1.0.1\lib\dotnet\ArgsReading.dll</HintPath>
4141
<Private>True</Private>
4242
</Reference>
43-
<Reference Include="Facility.CodeGen.Console, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
44-
<HintPath>..\..\packages\Facility.CodeGen.Console.1.0.0\lib\net45\Facility.CodeGen.Console.dll</HintPath>
43+
<Reference Include="Facility.CodeGen.Console, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
44+
<HintPath>..\..\packages\Facility.CodeGen.Console.1.2.0\lib\net45\Facility.CodeGen.Console.dll</HintPath>
4545
<Private>True</Private>
4646
</Reference>
47-
<Reference Include="Facility.Definition, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
48-
<HintPath>..\..\packages\Facility.Definition.1.0.0\lib\dotnet\Facility.Definition.dll</HintPath>
47+
<Reference Include="Facility.Definition, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
48+
<HintPath>..\..\packages\Facility.Definition.1.2.0\lib\dotnet\Facility.Definition.dll</HintPath>
4949
<Private>True</Private>
5050
</Reference>
5151
<Reference Include="Faithlife.Parsing, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">

src/fsdgenjs/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="ArgsReading" version="1.0.1" targetFramework="net452" />
4-
<package id="Facility.CodeGen.Console" version="1.0.0" targetFramework="net452" />
5-
<package id="Facility.Definition" version="1.0.0" targetFramework="net452" />
4+
<package id="Facility.CodeGen.Console" version="1.2.0" targetFramework="net452" />
5+
<package id="Facility.Definition" version="1.2.0" targetFramework="net452" />
66
<package id="Faithlife.Parsing" version="1.0.1" targetFramework="net452" />
77
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
88
<package id="YamlDotNet" version="4.0.0" targetFramework="net452" />

tests/Facility.CodeGen.JavaScript.UnitTests/Facility.CodeGen.JavaScript.UnitTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3333
</PropertyGroup>
3434
<ItemGroup>
35-
<Reference Include="Facility.Definition, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
36-
<HintPath>..\..\packages\Facility.Definition.1.0.0\lib\dotnet\Facility.Definition.dll</HintPath>
35+
<Reference Include="Facility.Definition, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
36+
<HintPath>..\..\packages\Facility.Definition.1.2.0\lib\dotnet\Facility.Definition.dll</HintPath>
3737
<Private>True</Private>
3838
</Reference>
3939
<Reference Include="Faithlife.Parsing, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">

tests/Facility.CodeGen.JavaScript.UnitTests/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Facility.Definition" version="1.0.0" targetFramework="net452" />
3+
<package id="Facility.Definition" version="1.2.0" targetFramework="net452" />
44
<package id="Faithlife.Parsing" version="1.0.1" targetFramework="net452" />
55
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
66
<package id="NUnit" version="3.6.0" targetFramework="net452" />

0 commit comments

Comments
 (0)