Skip to content

Commit 6c47d49

Browse files
authored
Merge branch 'master' into dm/validation
2 parents 9f7c7f6 + 5ceedcd commit 6c47d49

30 files changed

+1131
-55
lines changed

src/Microsoft.OpenApi/Expressions/BodyExpression.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,16 @@ public override string Expression
5454
return Body + PointerPrefix + Value;
5555
}
5656
}
57+
58+
/// <summary>
59+
/// Gets the fragment string.
60+
/// </summary>
61+
public string Fragment
62+
{
63+
get
64+
{
65+
return Value;
66+
}
67+
}
5768
}
5869
}

src/Microsoft.OpenApi/Expressions/HeaderExpression.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,16 @@ public override string Expression
3636
return Header + Value;
3737
}
3838
}
39+
40+
/// <summary>
41+
/// Gets the token string.
42+
/// </summary>
43+
public string Token
44+
{
45+
get
46+
{
47+
return Value;
48+
}
49+
}
3950
}
4051
}

src/Microsoft.OpenApi/Expressions/MethodExpression.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,17 @@ public sealed class MethodExpression : RuntimeExpression
1717
/// Gets the expression string.
1818
/// </summary>
1919
public override string Expression { get; } = Method;
20+
21+
/// <summary>
22+
/// Gets the singleton.
23+
/// </summary>
24+
public static MethodExpression Instance = new MethodExpression();
25+
26+
/// <summary>
27+
/// Private constructor.
28+
/// </summary>
29+
private MethodExpression()
30+
{
31+
}
2032
}
21-
}
33+
}

src/Microsoft.OpenApi/Expressions/PathExpression.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,16 @@ public override string Expression
3636
return Path + Value;
3737
}
3838
}
39+
40+
/// <summary>
41+
/// Gets the name string.
42+
/// </summary>
43+
public string Name
44+
{
45+
get
46+
{
47+
return Value;
48+
}
49+
}
3950
}
40-
}
51+
}

src/Microsoft.OpenApi/Expressions/QueryExpression.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,16 @@ public override string Expression
3636
return Query + Value;
3737
}
3838
}
39+
40+
/// <summary>
41+
/// Gets the name string.
42+
/// </summary>
43+
public string Name
44+
{
45+
get
46+
{
47+
return Value;
48+
}
49+
}
3950
}
40-
}
51+
}

src/Microsoft.OpenApi/Expressions/RequestExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ public RequestExpression(SourceExpression source)
3232
/// </summary>
3333
public SourceExpression Source { get; }
3434
}
35-
}
35+
}

src/Microsoft.OpenApi/Expressions/ResponseExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ public ResponseExpression(SourceExpression source)
3232
/// </summary>
3333
public SourceExpression Source { get; }
3434
}
35-
}
35+
}

src/Microsoft.OpenApi/Expressions/RuntimeExpression.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ public static RuntimeExpression Build(string expression)
4242
// $url
4343
if (expression == UrlExpression.Url)
4444
{
45-
return new UrlExpression();
45+
return UrlExpression.Instance;
4646
}
4747

4848
// $method
4949
if (expression == MethodExpression.Method)
5050
{
51-
return new MethodExpression();
51+
return MethodExpression.Instance;
5252
}
5353

5454
// $statusCode
5555
if (expression == StatusCodeExpression.StatusCode)
5656
{
57-
return new StatusCodeExpression();
57+
return StatusCodeExpression.Instance;
5858
}
5959

6060
// $request.
@@ -99,5 +99,11 @@ public bool Equals(RuntimeExpression obj)
9999
{
100100
return obj != null && obj.Expression == Expression;
101101
}
102+
103+
/// <inheritdoc />
104+
public override string ToString()
105+
{
106+
return Expression;
107+
}
102108
}
103-
}
109+
}

src/Microsoft.OpenApi/Expressions/SourceExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ protected SourceExpression(string value)
7272
throw new OpenApiException(string.Format(SRResource.SourceExpressionHasInvalidFormat, expression));
7373
}
7474
}
75-
}
75+
}

src/Microsoft.OpenApi/Expressions/StatusCodeExpression.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,17 @@ public sealed class StatusCodeExpression : RuntimeExpression
1717
/// Gets the expression string.
1818
/// </summary>
1919
public override string Expression { get; } = StatusCode;
20+
21+
/// <summary>
22+
/// Gets the singleton.
23+
/// </summary>
24+
public static StatusCodeExpression Instance = new StatusCodeExpression();
25+
26+
/// <summary>
27+
/// Private constructor.
28+
/// </summary>
29+
private StatusCodeExpression()
30+
{
31+
}
2032
}
21-
}
33+
}

0 commit comments

Comments
 (0)