Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
123 changes: 123 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
###############################
# Core EditorConfig Options #
###############################
# All files
[*]
indent_style = space
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
###############################
# VB Coding Conventions #
###############################
[*.vb]
# Modifier preferences
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
5 changes: 3 additions & 2 deletions Microsoft.OpenApi.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi", "src\Microsoft.OpenApi\Microsoft.OpenApi.csproj", "{A8E50143-69B2-472A-9D45-3F9A05D13202}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4AEDAD90-F854-4940-BFEE-6374CC92CAB0}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
build.cmd = build.cmd
readme.md = readme.md
EndProjectSection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public OpenApiReaderException(string message, YamlNode node) : base(message)
{
// This only includes line because using a char range causes tests to break due to CR/LF & LF differences
// See https://tools.ietf.org/html/rfc5147 for syntax
Pointer = $"#line={node.Start.Line}";
Pointer = $"#line={node.Start.Line}";
}

/// <summary>
Expand All @@ -43,4 +43,4 @@ public OpenApiReaderException(string message, YamlNode node) : base(message)
/// <param name="innerException">Inner exception that caused this exception to be thrown.</param>
public OpenApiReaderException(string message, Exception innerException) : base(message, innerException) { }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ public OpenApiUnsupportedSpecVersionException(string specificationVersion, Excep
/// </summary>
public string SpecificationVersion { get; }
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/Interface/IDiagnostic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ namespace Microsoft.OpenApi.Readers.Interface
public interface IDiagnostic
{
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/Interface/IOpenApiReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public interface IOpenApiReader<TInput, TDiagnostic> where TDiagnostic : IDiagno
/// <returns>The Open API document.</returns>
OpenApiDocument Read(TInput input, out TDiagnostic diagnostic);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ internal interface IOpenApiVersionService
/// <returns>Instance of OpenApiDocument populated with data from rootNode</returns>
OpenApiDocument LoadDocument(RootNode rootNode);
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/OpenApiDiagnostic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public class OpenApiDiagnostic : IDiagnostic
/// </summary>
public OpenApiSpecVersion SpecificationVersion { get; set; }
}
}
}
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi.Readers/OpenApiReaderSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class OpenApiReaderSettings
/// <summary>
/// Dictionary of parsers for converting extensions into strongly typed classes
/// </summary>
public Dictionary<string, Func<IOpenApiAny , OpenApiSpecVersion, IOpenApiExtension>> ExtensionParsers { get; set; } = new Dictionary<string, Func<IOpenApiAny, OpenApiSpecVersion, IOpenApiExtension>>();
public Dictionary<string, Func<IOpenApiAny, OpenApiSpecVersion, IOpenApiExtension>> ExtensionParsers { get; set; } = new Dictionary<string, Func<IOpenApiAny, OpenApiSpecVersion, IOpenApiExtension>>();

/// <summary>
/// Rules to use for validating OpenAPI specification. If none are provided a default set of rules are applied.
Expand All @@ -52,6 +52,6 @@ public class OpenApiReaderSettings
/// <summary>
/// URL where relative references should be resolved from if the description does not contain Server definitions
/// </summary>
public Uri BaseUrl { get; set; }
public Uri BaseUrl { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/OpenApiStreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ public T ReadFragment<T>(Stream input, OpenApiSpecVersion version, out OpenApiDi
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/OpenApiStringReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public T ReadFragment<T>(string input, OpenApiSpecVersion version, out OpenApiDi
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/OpenApiTextReaderReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ static YamlDocument LoadYamlDocument(TextReader input)
return yamlStream.Documents.First();
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/OpenApiYamlDocumentReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ public T ReadFragment<T>(YamlDocument input, OpenApiSpecVersion version, out Ope
return (T)element;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/AnyFieldMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ namespace Microsoft.OpenApi.Readers.ParseNodes
internal class AnyFieldMap<T> : Dictionary<string, AnyFieldMapParameter<T>>
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ internal class AnyListFieldMap<T> : Dictionary<string, AnyListFieldMapParameter<
{

}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/AnyMapFieldMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ internal class AnyMapFieldMap<T, U> : Dictionary<string, AnyMapFieldMapParameter
{

}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/FixedFieldMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ namespace Microsoft.OpenApi.Readers.ParseNodes
internal class FixedFieldMap<T> : Dictionary<string, Action<T, ParseNode>>
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ public static YamlNode Find(this JsonPointer currentPointer, YamlNode baseYamlNo
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/ListNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ public override IOpenApiAny CreateAny()
return array;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/MapNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ public override IOpenApiAny CreateAny()
return apiObject;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/ParseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ public virtual List<IOpenApiAny> CreateListOfAny()
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ namespace Microsoft.OpenApi.Readers.ParseNodes
internal class PatternFieldMap<T> : Dictionary<Func<string, bool>, Action<T, string, ParseNode>>
{
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/PropertyNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ public override IOpenApiAny CreateAny()
throw new NotImplementedException();
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/RootNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ public MapNode GetMap()
return new MapNode(Context, (YamlMappingNode)_yamlDocument.RootNode);
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParsingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,4 @@ public void PopLoop(string loopid)
}

}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

[assembly:
InternalsVisibleTo(
"Microsoft.OpenApi.Readers.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100957cb48387b2a5f54f5ce39255f18f26d32a39990db27cf48737afc6bc62759ba996b8a2bfb675d4e39f3d06ecb55a178b1b4031dcb2a767e29977d88cce864a0d16bfc1b3bebb0edf9fe285f10fffc0a85f93d664fa05af07faa3aad2e545182dbf787e3fd32b56aca95df1a3c4e75dec164a3f1a4c653d971b01ffc39eb3c4")]
"Microsoft.OpenApi.Readers.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100957cb48387b2a5f54f5ce39255f18f26d32a39990db27cf48737afc6bc62759ba996b8a2bfb675d4e39f3d06ecb55a178b1b4031dcb2a767e29977d88cce864a0d16bfc1b3bebb0edf9fe285f10fffc0a85f93d664fa05af07faa3aad2e545182dbf787e3fd32b56aca95df1a3c4e75dec164a3f1a4c653d971b01ffc39eb3c4")]
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal class OpenApiReferenceResolver : OpenApiVisitorBase
private bool _resolveRemoteReferences;
private List<OpenApiError> _errors = new List<OpenApiError>();

public OpenApiReferenceResolver(OpenApiDocument currentDocument, bool resolveRemoteReferences = true)
public OpenApiReferenceResolver(OpenApiDocument currentDocument, bool resolveRemoteReferences = true)
{
_currentDocument = currentDocument;
_resolveRemoteReferences = resolveRemoteReferences;
Expand Down Expand Up @@ -66,7 +66,7 @@ public override void Visit(OpenApiOperation operation)
{
ResolveObject(operation.RequestBody, r => operation.RequestBody = r);
ResolveList(operation.Parameters);

if (operation.Tags != null)
{
ResolveTags(operation.Tags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public static OpenApiContact LoadContact(ParseNode node)
return contact;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,4 @@ public override void Visit(OpenApiOperation operation)


}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ public static OpenApiExternalDocs LoadExternalDocs(ParseNode node)
return externalDocs;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@ private static void LoadStyle(OpenApiHeader header, string style)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ public static OpenApiInfo LoadInfo(ParseNode node)
return info;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public static OpenApiLicense LoadLicense(ParseNode node)
return license;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,4 @@ private static OpenApiTag LoadTagByReference(
return tagObject;
}
}
}
}
Loading