Skip to content

Commit 6c1a6a4

Browse files
committed
More valid code.
1 parent 00a81f0 commit 6c1a6a4

1 file changed

Lines changed: 58 additions & 3 deletions

File tree

ValidCode/IdentityController.cs

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,69 @@
11
namespace ValidCode
22
{
3+
using System;
34
using Microsoft.AspNetCore.Mvc;
45

56
[ApiController]
67
public class IdentityController : Controller
78
{
8-
[HttpGet("string/{text:minlength(1):maxlength(2)}")]
9-
public IActionResult GetString(string text)
9+
[HttpGet("ints/{value:int:min(1):max(2):range(3)}")]
10+
public IActionResult Get(int value)
1011
{
11-
return this.Ok(text);
12+
return this.Ok(value);
13+
}
14+
15+
[HttpGet("bools/{value}")]
16+
public IActionResult Get(bool value)
17+
{
18+
return this.Ok(value);
19+
}
20+
21+
[HttpGet("maybe-bools/{value?}")]
22+
public IActionResult Get(bool? value)
23+
{
24+
return this.Ok(value);
25+
}
26+
27+
[HttpGet("times/{value:datetime}")]
28+
public IActionResult Get(DateTime value)
29+
{
30+
return this.Ok(value);
31+
}
32+
33+
[HttpGet("decimals/{value:decimal}")]
34+
public IActionResult Get(decimal value)
35+
{
36+
return this.Ok(value);
37+
}
38+
39+
[HttpGet("doubles/{value:double}")]
40+
public IActionResult Get(double value)
41+
{
42+
return this.Ok(value);
43+
}
44+
45+
[HttpGet("floats/{value:float}")]
46+
public IActionResult Get(float value)
47+
{
48+
return this.Ok(value);
49+
}
50+
51+
[HttpGet("times/{value:guid}")]
52+
public IActionResult Get(Guid value)
53+
{
54+
return this.Ok(value);
55+
}
56+
57+
[HttpGet("longs/{value:long}")]
58+
public IActionResult Get(long value)
59+
{
60+
return this.Ok(value);
61+
}
62+
63+
[HttpGet("strings/{value:minlength(1):maxlength(2):required:alpha}")]
64+
public IActionResult Get(string value)
65+
{
66+
return this.Ok(value);
1267
}
1368
}
1469
}

0 commit comments

Comments
 (0)