Skip to content

Commit 8ca00d1

Browse files
authored
remove some redundant field defaults (#1385)
* remove some redundant field defaults * Update OpenApiJsonWriter.cs
1 parent 789c807 commit 8ca00d1

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

src/Microsoft.OpenApi.Workbench/MainModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ public class MainModel : INotifyPropertyChanged
2424
{
2525
private string _input;
2626

27-
private bool _inlineLocal = false;
28-
private bool _inlineExternal = false;
27+
private bool _inlineLocal;
28+
private bool _inlineExternal;
2929

30-
private bool _resolveExternal = false;
30+
private bool _resolveExternal;
3131

3232
private string _inputFile;
3333

src/Microsoft.OpenApi.Workbench/StatsVisitor.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,63 +10,63 @@ namespace Microsoft.OpenApi.Workbench
1010
{
1111
internal class StatsVisitor : OpenApiVisitorBase
1212
{
13-
public int ParameterCount { get; set; } = 0;
13+
public int ParameterCount { get; set; }
1414

1515
public override void Visit(OpenApiParameter parameter)
1616
{
1717
ParameterCount++;
1818
}
1919

20-
public int SchemaCount { get; set; } = 0;
20+
public int SchemaCount { get; set; }
2121

2222
public override void Visit(OpenApiSchema schema)
2323
{
2424
SchemaCount++;
2525
}
2626

27-
public int HeaderCount { get; set; } = 0;
27+
public int HeaderCount { get; set; }
2828

2929
public override void Visit(IDictionary<string, OpenApiHeader> headers)
3030
{
3131
HeaderCount++;
3232
}
3333

34-
public int PathItemCount { get; set; } = 0;
34+
public int PathItemCount { get; set; }
3535

3636
public override void Visit(OpenApiPathItem pathItem)
3737
{
3838
PathItemCount++;
3939
}
4040

41-
public int RequestBodyCount { get; set; } = 0;
41+
public int RequestBodyCount { get; set; }
4242

4343
public override void Visit(OpenApiRequestBody requestBody)
4444
{
4545
RequestBodyCount++;
4646
}
4747

48-
public int ResponseCount { get; set; } = 0;
48+
public int ResponseCount { get; set; }
4949

5050
public override void Visit(OpenApiResponses response)
5151
{
5252
ResponseCount++;
5353
}
5454

55-
public int OperationCount { get; set; } = 0;
55+
public int OperationCount { get; set; }
5656

5757
public override void Visit(OpenApiOperation operation)
5858
{
5959
OperationCount++;
6060
}
6161

62-
public int LinkCount { get; set; } = 0;
62+
public int LinkCount { get; set; }
6363

6464
public override void Visit(OpenApiLink operation)
6565
{
6666
LinkCount++;
6767
}
6868

69-
public int CallbackCount { get; set; } = 0;
69+
public int CallbackCount { get; set; }
7070

7171
public override void Visit(OpenApiCallback callback)
7272
{

src/Microsoft.OpenApi/Models/OpenApiExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class OpenApiExample : IOpenApiSerializable, IOpenApiReferenceable, IOpen
5252
/// <summary>
5353
/// Indicates object is a placeholder reference to an actual object and does not contain valid data.
5454
/// </summary>
55-
public bool UnresolvedReference { get; set; } = false;
55+
public bool UnresolvedReference { get; set; }
5656

5757
/// <summary>
5858
/// Parameter-less constructor

src/Microsoft.OpenApi/Models/OpenApiParameter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class OpenApiParameter : IOpenApiSerializable, IOpenApiReferenceable, IEf
6161
/// <summary>
6262
/// Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
6363
/// </summary>
64-
public bool Deprecated { get; set; } = false;
64+
public bool Deprecated { get; set; }
6565

6666
/// <summary>
6767
/// Sets the ability to pass empty-valued parameters.
@@ -70,7 +70,7 @@ public class OpenApiParameter : IOpenApiSerializable, IOpenApiReferenceable, IEf
7070
/// If style is used, and if behavior is n/a (cannot be serialized),
7171
/// the value of allowEmptyValue SHALL be ignored.
7272
/// </summary>
73-
public bool AllowEmptyValue { get; set; } = false;
73+
public bool AllowEmptyValue { get; set; }
7474

7575
/// <summary>
7676
/// Describes how the parameter value will be serialized depending on the type of the parameter value.

src/Microsoft.OpenApi/Models/OpenApiReference.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class OpenApiReference : IOpenApiSerializable
5353
/// <summary>
5454
/// The OpenApiDocument that is hosting the OpenApiReference instance. This is used to enable dereferencing the reference.
5555
/// </summary>
56-
public OpenApiDocument HostDocument { get; set; } = null;
56+
public OpenApiDocument HostDocument { get; set; }
5757

5858
/// <summary>
5959
/// Gets the full reference string for v3.0.

src/Microsoft.OpenApi/Writers/OpenApiJsonWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public OpenApiJsonWriter(TextWriter textWriter, OpenApiWriterSettings settings,
4242
/// <summary>
4343
/// Indicates whether or not the produced document will be written in a compact or pretty fashion.
4444
/// </summary>
45-
private bool _produceTerseOutput = false;
45+
private readonly bool _produceTerseOutput;
4646

4747
/// <summary>
4848
/// Base Indentation Level.

src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ public ReferenceInlineSetting ReferenceInline {
6363
/// <summary>
6464
/// Indicates if local references should be rendered as an inline object
6565
/// </summary>
66-
public bool InlineLocalReferences { get; set; } = false;
66+
public bool InlineLocalReferences { get; set; }
6767

6868
/// <summary>
6969
/// Indicates if external references should be rendered as an inline object
7070
/// </summary>
71-
public bool InlineExternalReferences { get; set; } = false;
71+
public bool InlineExternalReferences { get; set; }
7272

7373
internal bool ShouldInlineReference(OpenApiReference reference)
7474
{

0 commit comments

Comments
 (0)