Skip to content

Commit cd41026

Browse files
committed
Merge branch 'main' into feat/enable-NRT
2 parents 07b3a2c + d8553d6 commit cd41026

File tree

11 files changed

+98
-14
lines changed

11 files changed

+98
-14
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# File initially created using https://github.com/MIchaelMainer/policyservicetoolkit/blob/main/branch_protection_export.ps1.
5+
6+
name: OpenAPI.NET-branch-protection
7+
description: Branch protection policy for the OpenAPI.NET repository
8+
resource: repository
9+
configuration:
10+
branchProtectionRules:
11+
12+
- branchNamePattern: main
13+
# This branch pattern applies to the following branches as of approximately 02/27/2025 15:28:20:
14+
# main
15+
16+
# Specifies whether this branch can be deleted. boolean
17+
allowsDeletions: false
18+
# Specifies whether forced pushes are allowed on this branch. boolean
19+
allowsForcePushes: false
20+
# Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean
21+
dismissStaleReviews: true
22+
# Specifies whether admins can overwrite branch protection. boolean
23+
isAdminEnforced: true
24+
# Indicates whether "Require a pull request before merging" is enabled. boolean
25+
requiresPullRequestBeforeMerging: true
26+
# Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required
27+
requiredApprovingReviewsCount: 1
28+
# Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean
29+
requireCodeOwnersReview: true
30+
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
31+
requiresCommitSignatures: false
32+
# Are conversations required to be resolved before merging? boolean
33+
requiresConversationResolution: true
34+
# Are merge commits prohibited from being pushed to this branch. boolean
35+
requiresLinearHistory: false
36+
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
37+
requiredStatusChecks:
38+
- license/cla
39+
- CodeQL
40+
- Continuous Integration
41+
# Require branches to be up to date before merging. boolean
42+
requiresStrictStatusChecks: false
43+
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
44+
restrictsPushes: false
45+
# Restrict who can dismiss pull request reviews. boolean
46+
restrictsReviewDismissals: false
47+
48+
- branchNamePattern: support/v1
49+
# This branch pattern applies to the following branches as of approximately 02/27/2025 15:28:20:
50+
# support/v1
51+
52+
# Specifies whether this branch can be deleted. boolean
53+
allowsDeletions: false
54+
# Specifies whether forced pushes are allowed on this branch. boolean
55+
allowsForcePushes: false
56+
# Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean
57+
dismissStaleReviews: true
58+
# Specifies whether admins can overwrite branch protection. boolean
59+
isAdminEnforced: true
60+
# Indicates whether "Require a pull request before merging" is enabled. boolean
61+
requiresPullRequestBeforeMerging: true
62+
# Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required
63+
requiredApprovingReviewsCount: 1
64+
# Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean
65+
requireCodeOwnersReview: true
66+
# Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines.
67+
requiresCommitSignatures: false
68+
# Are conversations required to be resolved before merging? boolean
69+
requiresConversationResolution: true
70+
# Are merge commits prohibited from being pushed to this branch. boolean
71+
requiresLinearHistory: false
72+
# Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status
73+
requiredStatusChecks:
74+
- license/cla
75+
- CodeQL
76+
- Continuous Integration
77+
# Require branches to be up to date before merging. boolean
78+
requiresStrictStatusChecks: false
79+
# Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush.
80+
restrictsPushes: false
81+
# Restrict who can dismiss pull request reviews. boolean
82+
restrictsReviewDismissals: false
83+

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
![Category overview screenshot](docs/images/oainet.png "Microsoft + OpenAPI = Love")
1+
<!-- using the raw image URL so it displays correctly on nuget.org -->
2+
![Category overview screenshot](https://raw.githubusercontent.com/microsoft/OpenAPI.NET/main/docs/images/oainet.png "Microsoft + OpenAPI = Love")
23

34
# OpenAPI.NET
45

@@ -109,7 +110,7 @@ In order to test the validity of an OpenApi document, we avail the following too
109110
4. Run the project and you'll see a GUI pop up resembling the one below:
110111

111112

112-
<img src="https://user-images.githubusercontent.com/36787645/235884441-f45d2ef7-c27b-4e1a-a890-d6f7fbef87c3.png" width="700" height="500">
113+
![workbench preview](https://raw.githubusercontent.com/microsoft/OpenAPI.NET/main/docs/images/workbench.png "a screenshot of the workbench application")
113114

114115
5. Copy and paste your OpenAPI descriptions in the **Input Content** window or paste the path to the descriptions file in the **Input File** textbox and click on `Convert` to render the results.
115116

docs/images/workbench.png

70.4 KB
Loading

src/Microsoft.OpenApi/Models/OpenApiDocument.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void RegisterComponents()
7373
/// <summary>
7474
/// A declaration of which security mechanisms can be used across the API.
7575
/// </summary>
76-
public IList<OpenApiSecurityRequirement>? SecurityRequirements { get; set; } =
76+
public IList<OpenApiSecurityRequirement>? Security { get; set; } =
7777
new List<OpenApiSecurityRequirement>();
7878

7979
private HashSet<OpenApiTag>? _tags;
@@ -139,7 +139,7 @@ public OpenApiDocument(OpenApiDocument? document)
139139
Paths = document?.Paths != null ? new(document.Paths) : new OpenApiPaths();
140140
Webhooks = document?.Webhooks != null ? new Dictionary<string, IOpenApiPathItem>(document.Webhooks) : null;
141141
Components = document?.Components != null ? new(document?.Components) : null;
142-
SecurityRequirements = document?.SecurityRequirements != null ? new List<OpenApiSecurityRequirement>(document.SecurityRequirements) : null;
142+
Security = document?.Security != null ? new List<OpenApiSecurityRequirement>(document.Security) : null;
143143
Tags = document?.Tags != null ? new HashSet<OpenApiTag>(document.Tags, OpenApiTagComparer.Instance) : null;
144144
ExternalDocs = document?.ExternalDocs != null ? new(document.ExternalDocs) : null;
145145
Extensions = document?.Extensions != null ? new Dictionary<string, IOpenApiExtension>(document.Extensions) : null;
@@ -223,7 +223,7 @@ private void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersion version
223223
// security
224224
writer.WriteOptionalCollection(
225225
OpenApiConstants.Security,
226-
SecurityRequirements,
226+
Security,
227227
callback);
228228

229229
// tags
@@ -370,7 +370,7 @@ public void SerializeAsV2(IOpenApiWriter writer)
370370
// security
371371
writer.WriteOptionalCollection(
372372
OpenApiConstants.Security,
373-
SecurityRequirements,
373+
Security,
374374
(w, s) => s.SerializeAsV2(w));
375375

376376
// tags

src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ internal static partial class OpenApiV2Deserializer
106106
o.Components.SecuritySchemes = n.CreateMap(LoadSecurityScheme, o);
107107
}
108108
},
109-
{"security", (o, n, _) => o.SecurityRequirements = n.CreateList(LoadSecurityRequirement, o)},
109+
{"security", (o, n, _) => o.Security = n.CreateList(LoadSecurityRequirement, o)},
110110
{"tags", (o, n, _) => { if (n.CreateList(LoadTag, o) is {Count:> 0} tags) {o.Tags = new HashSet<OpenApiTag>(tags, OpenApiTagComparer.Instance); } } },
111111
{"externalDocs", (o, n, _) => o.ExternalDocs = LoadExternalDocs(n, o)}
112112
};

src/Microsoft.OpenApi/Reader/V3/OpenApiDocumentDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal static partial class OpenApiV3Deserializer
2929
{"components", (o, n, _) => o.Components = LoadComponents(n, o)},
3030
{"tags", (o, n, _) => { if (n.CreateList(LoadTag, o) is {Count:> 0} tags) {o.Tags = new HashSet<OpenApiTag>(tags, OpenApiTagComparer.Instance); } } },
3131
{"externalDocs", (o, n, _) => o.ExternalDocs = LoadExternalDocs(n, o)},
32-
{"security", (o, n, _) => o.SecurityRequirements = n.CreateList(LoadSecurityRequirement, o)}
32+
{"security", (o, n, _) => o.Security = n.CreateList(LoadSecurityRequirement, o)}
3333
};
3434

3535
private static readonly PatternFieldMap<OpenApiDocument> _openApiPatternFields = new PatternFieldMap<OpenApiDocument>

src/Microsoft.OpenApi/Reader/V31/OpenApiDocumentDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal static partial class OpenApiV31Deserializer
2727
{"components", (o, n, _) => o.Components = LoadComponents(n, o)},
2828
{"tags", (o, n, _) => { if (n.CreateList(LoadTag, o) is {Count:> 0} tags) {o.Tags = new HashSet<OpenApiTag>(tags, OpenApiTagComparer.Instance); } } },
2929
{"externalDocs", (o, n, _) => o.ExternalDocs = LoadExternalDocs(n, o)},
30-
{"security", (o, n, _) => o.SecurityRequirements = n.CreateList(LoadSecurityRequirement, o)}
30+
{"security", (o, n, _) => o.Security = n.CreateList(LoadSecurityRequirement, o)}
3131
};
3232

3333
private static readonly PatternFieldMap<OpenApiDocument> _openApiPatternFields = new()

src/Microsoft.OpenApi/Services/OpenApiFilterService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static OpenApiDocument CreateFilteredDocument(OpenApiDocument? source, Fu
8080
},
8181

8282
Components = components,
83-
SecurityRequirements = source?.SecurityRequirements,
83+
SecurityRequirements = source?.Security,
8484
Servers = source?.Servers
8585
};
8686

src/Microsoft.OpenApi/Services/OpenApiWalker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void Walk(OpenApiDocument? doc)
5252
Walk(OpenApiConstants.Paths, () => Walk(doc.Paths));
5353
Walk(OpenApiConstants.Webhooks, () => Walk(doc.Webhooks));
5454
Walk(OpenApiConstants.Components, () => Walk(doc.Components));
55-
Walk(OpenApiConstants.Security, () => Walk(doc.SecurityRequirements));
55+
Walk(OpenApiConstants.Security, () => Walk(doc.Security));
5656
Walk(OpenApiConstants.ExternalDocs, () => Walk(doc.ExternalDocs));
5757
Walk(OpenApiConstants.Tags, () => Walk(doc.Tags));
5858
Walk(doc as IOpenApiExtensible);

test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed()
10081008
Description = "tagDescription2"
10091009
}
10101010
},
1011-
SecurityRequirements = new List<OpenApiSecurityRequirement>
1011+
Security = new List<OpenApiSecurityRequirement>
10121012
{
10131013
new OpenApiSecurityRequirement
10141014
{
@@ -1052,7 +1052,7 @@ public async Task GlobalSecurityRequirementShouldReferenceSecurityScheme()
10521052
{
10531053
var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "securedApi.yaml"), SettingsFixture.ReaderSettings);
10541054

1055-
var securityRequirement = result.Document.SecurityRequirements[0];
1055+
var securityRequirement = result.Document.Security[0];
10561056

10571057
Assert.Equivalent(result.Document.Components.SecuritySchemes.First().Value, securityRequirement.Keys.First());
10581058
}

0 commit comments

Comments
 (0)