Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use some expression gets #1420

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/Microsoft.OpenApi/Expressions/BodyExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ public override string Expression
/// <summary>
/// Gets the fragment string.
/// </summary>
public string Fragment
{
get
{
return Value;
}
}
public string Fragment { get => Value; }
}
}
16 changes: 2 additions & 14 deletions src/Microsoft.OpenApi/Expressions/HeaderExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,11 @@ public HeaderExpression(string token)
/// <summary>
/// Gets the expression string.
/// </summary>
public override string Expression
{
get
{
return Header + Value;
}
}
public override string Expression { get => Header + Value; }

/// <summary>
/// Gets the token string.
/// </summary>
public string Token
{
get
{
return Value;
}
}
public string Token { get => Value; }
}
}
16 changes: 2 additions & 14 deletions src/Microsoft.OpenApi/Expressions/PathExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,11 @@ public PathExpression(string name)
/// <summary>
/// Gets the expression string.
/// </summary>
public override string Expression
{
get
{
return Path + Value;
}
}
public override string Expression { get => Path + Value; }

/// <summary>
/// Gets the name string.
/// </summary>
public string Name
{
get
{
return Value;
}
}
public string Name { get => Value; }
}
}
16 changes: 2 additions & 14 deletions src/Microsoft.OpenApi/Expressions/QueryExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,11 @@ public QueryExpression(string name)
/// <summary>
/// Gets the expression string.
/// </summary>
public override string Expression
{
get
{
return Query + Value;
}
}
public override string Expression { get => Query + Value; }

/// <summary>
/// Gets the name string.
/// </summary>
public string Name
{
get
{
return Value;
}
}
public string Name { get => Value; }
}
}
8 changes: 1 addition & 7 deletions src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ public virtual void Exit()
/// <summary>
/// Pointer to source of validation error in document
/// </summary>
public string PathString
{
get
{
return "#/" + String.Join("/", _path.Reverse());
}
}
public string PathString { get => "#/" + String.Join("/", _path.Reverse()); }

/// <summary>
/// Visits <see cref="OpenApiDocument"/>
Expand Down
16 changes: 2 additions & 14 deletions src/Microsoft.OpenApi/Validations/OpenApiValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,12 @@ public OpenApiValidator(ValidationRuleSet ruleSet)
/// <summary>
/// Gets the validation errors.
/// </summary>
public IEnumerable<OpenApiValidatorError> Errors
{
get
{
return _errors;
}
}
public IEnumerable<OpenApiValidatorError> Errors { get => _errors; }

/// <summary>
/// Gets the validation warnings.
/// </summary>
public IEnumerable<OpenApiValidatorWarning> Warnings
{
get
{
return _warnings;
}
}
public IEnumerable<OpenApiValidatorWarning> Warnings { get => _warnings; }

/// <summary>
/// Register an error with the validation context.
Expand Down
5 changes: 1 addition & 4 deletions src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ public ValidationRuleSet(IEnumerable<ValidationRule> rules)
/// </summary>
public IList<ValidationRule> Rules
{
get
{
return _rules.Values.SelectMany(v => v).ToList();
}
get => _rules.Values.SelectMany(v => v).ToList();
}

/// <summary>
Expand Down
8 changes: 1 addition & 7 deletions src/Microsoft.OpenApi/Writers/Scope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@ public Scope(ScopeType type)
/// <summary>
/// Gets the scope type for this scope.
/// </summary>
public ScopeType Type
{
get
{
return _type;
}
}
public ScopeType Type { get => _type; }

/// <summary>
/// Get/Set the whether it is in previous array scope.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,10 @@ public void WriteOpenApiDateTimeAsJsonWorks(string inputString, bool produceTers

public static IEnumerable<object[]> BooleanInputs
{
get
{
return
from input in new [] { true, false }
from shouldBeTerse in shouldProduceTerseOutputValues
select new object[] { input, shouldBeTerse };
}
get =>
from input in new [] { true, false }
from shouldBeTerse in shouldProduceTerseOutputValues
select new object[] { input, shouldBeTerse };
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,20 @@ public class OpenApiWriterSpecialCharacterTests

public static IEnumerable<object[]> StringWithSpecialCharacters
{
get
{
return
from inputExpected in new[] {
new[]{ "Test\bTest", "\"Test\\bTest\"" },
new[]{ "Test\fTest", "\"Test\\fTest\""},
new[]{ "Test\nTest", "\"Test\\nTest\""},
new[]{ "Test\rTest", "\"Test\\rTest\""},
new[]{ "Test\tTest", "\"Test\\tTest\""},
new[]{ "Test\\Test", "\"Test\\\\Test\""},
new[]{ "Test\"Test", "\"Test\\\"Test\""},
new[]{ "StringsWith\"Quotes\"", "\"StringsWith\\\"Quotes\\\"\""},
new[]{ "0x1234", "\"0x1234\""},
}
from shouldBeTerse in shouldProduceTerseOutputValues
select new object[] { inputExpected[0], inputExpected[1], shouldBeTerse };
}
get =>
from inputExpected in new[] {
new[]{ "Test\bTest", "\"Test\\bTest\"" },
new[]{ "Test\fTest", "\"Test\\fTest\""},
new[]{ "Test\nTest", "\"Test\\nTest\""},
new[]{ "Test\rTest", "\"Test\\rTest\""},
new[]{ "Test\tTest", "\"Test\\tTest\""},
new[]{ "Test\\Test", "\"Test\\\\Test\""},
new[]{ "Test\"Test", "\"Test\\\"Test\""},
new[]{ "StringsWith\"Quotes\"", "\"StringsWith\\\"Quotes\\\"\""},
new[]{ "0x1234", "\"0x1234\""},
}
from shouldBeTerse in shouldProduceTerseOutputValues
select new object[] { inputExpected[0], inputExpected[1], shouldBeTerse };
}

[Theory]
Expand Down
Loading