diff --git a/src/Microsoft.OpenApi.Workbench/MainModel.cs b/src/Microsoft.OpenApi.Workbench/MainModel.cs index c7a3b5c7e..acfd28bdf 100644 --- a/src/Microsoft.OpenApi.Workbench/MainModel.cs +++ b/src/Microsoft.OpenApi.Workbench/MainModel.cs @@ -24,10 +24,10 @@ public class MainModel : INotifyPropertyChanged { private string _input; - private bool _inlineLocal = false; - private bool _inlineExternal = false; + private bool _inlineLocal; + private bool _inlineExternal; - private bool _resolveExternal = false; + private bool _resolveExternal; private string _inputFile; diff --git a/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs b/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs index c8cf28799..eb93f9b9f 100644 --- a/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs @@ -10,63 +10,63 @@ namespace Microsoft.OpenApi.Workbench { internal class StatsVisitor : OpenApiVisitorBase { - public int ParameterCount { get; set; } = 0; + public int ParameterCount { get; set; } public override void Visit(OpenApiParameter parameter) { ParameterCount++; } - public int SchemaCount { get; set; } = 0; + public int SchemaCount { get; set; } public override void Visit(OpenApiSchema schema) { SchemaCount++; } - public int HeaderCount { get; set; } = 0; + public int HeaderCount { get; set; } public override void Visit(IDictionary headers) { HeaderCount++; } - public int PathItemCount { get; set; } = 0; + public int PathItemCount { get; set; } public override void Visit(OpenApiPathItem pathItem) { PathItemCount++; } - public int RequestBodyCount { get; set; } = 0; + public int RequestBodyCount { get; set; } public override void Visit(OpenApiRequestBody requestBody) { RequestBodyCount++; } - public int ResponseCount { get; set; } = 0; + public int ResponseCount { get; set; } public override void Visit(OpenApiResponses response) { ResponseCount++; } - public int OperationCount { get; set; } = 0; + public int OperationCount { get; set; } public override void Visit(OpenApiOperation operation) { OperationCount++; } - public int LinkCount { get; set; } = 0; + public int LinkCount { get; set; } public override void Visit(OpenApiLink operation) { LinkCount++; } - public int CallbackCount { get; set; } = 0; + public int CallbackCount { get; set; } public override void Visit(OpenApiCallback callback) { diff --git a/src/Microsoft.OpenApi/Models/OpenApiExample.cs b/src/Microsoft.OpenApi/Models/OpenApiExample.cs index 4d091a361..01dcdf6ba 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiExample.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiExample.cs @@ -52,7 +52,7 @@ public class OpenApiExample : IOpenApiSerializable, IOpenApiReferenceable, IOpen /// /// Indicates object is a placeholder reference to an actual object and does not contain valid data. /// - public bool UnresolvedReference { get; set; } = false; + public bool UnresolvedReference { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs index 3918f233b..c5facc4dd 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs @@ -61,7 +61,7 @@ public class OpenApiParameter : IOpenApiSerializable, IOpenApiReferenceable, IEf /// /// Specifies that a parameter is deprecated and SHOULD be transitioned out of usage. /// - public bool Deprecated { get; set; } = false; + public bool Deprecated { get; set; } /// /// Sets the ability to pass empty-valued parameters. @@ -70,7 +70,7 @@ public class OpenApiParameter : IOpenApiSerializable, IOpenApiReferenceable, IEf /// If style is used, and if behavior is n/a (cannot be serialized), /// the value of allowEmptyValue SHALL be ignored. /// - public bool AllowEmptyValue { get; set; } = false; + public bool AllowEmptyValue { get; set; } /// /// Describes how the parameter value will be serialized depending on the type of the parameter value. diff --git a/src/Microsoft.OpenApi/Models/OpenApiReference.cs b/src/Microsoft.OpenApi/Models/OpenApiReference.cs index e8798cc64..2b6d47385 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiReference.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiReference.cs @@ -53,7 +53,7 @@ public class OpenApiReference : IOpenApiSerializable /// /// The OpenApiDocument that is hosting the OpenApiReference instance. This is used to enable dereferencing the reference. /// - public OpenApiDocument HostDocument { get; set; } = null; + public OpenApiDocument HostDocument { get; set; } /// /// Gets the full reference string for v3.0. diff --git a/src/Microsoft.OpenApi/Writers/OpenApiJsonWriter.cs b/src/Microsoft.OpenApi/Writers/OpenApiJsonWriter.cs index 10049974b..746ae9dda 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiJsonWriter.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiJsonWriter.cs @@ -42,7 +42,7 @@ public OpenApiJsonWriter(TextWriter textWriter, OpenApiWriterSettings settings, /// /// Indicates whether or not the produced document will be written in a compact or pretty fashion. /// - private bool _produceTerseOutput = false; + private readonly bool _produceTerseOutput; /// /// Base Indentation Level. diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index 06fcd0246..f87d01c24 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -63,12 +63,12 @@ public ReferenceInlineSetting ReferenceInline { /// /// Indicates if local references should be rendered as an inline object /// - public bool InlineLocalReferences { get; set; } = false; + public bool InlineLocalReferences { get; set; } /// /// Indicates if external references should be rendered as an inline object /// - public bool InlineExternalReferences { get; set; } = false; + public bool InlineExternalReferences { get; set; } internal bool ShouldInlineReference(OpenApiReference reference) {