-
Notifications
You must be signed in to change notification settings - Fork 0
DO NOT MERGE - review PR before submission upstream #44
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
Conversation
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
adds new OAS vesion and serialization/deserialization infrastructure
…d value in OAS 3.2
sync from upstream main
…ialization-infrastructure-for-v32 Adds serialization/deserialization unit tests for 3.2
* Initial plan * Add Summary support to OpenApiResponse with serialization/deserialization Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> * Complete implementation with reference support and test fixes Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> * Update IOpenApiResponse to derive from IOpenApiSummarizedElement Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> * Apply suggestions from code review * Apply suggestion from @baywet * chore: copy reference implementation Signed-off-by: Vincent Biret <vibiret@microsoft.com> * chore: adds missing using Signed-off-by: Vincent Biret <vibiret@microsoft.com> * chore: linting Signed-off-by: Vincent Biret <vibiret@microsoft.com> * chore: updates public API export Signed-off-by: Vincent Biret <vibiret@microsoft.com> --------- Signed-off-by: Vincent Biret <vibiret@microsoft.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> Co-authored-by: Vincent Biret <vincentbiret@hotmail.com> Co-authored-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
chore: updates benchmark results
…e8-b196-901596c61b07
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
…b196-901596c61b07 feat: Implement OpenAPI 3.2.0 server name field
…ization Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
foreach(var type in list) | ||
{ | ||
if (type is not null) | ||
{ | ||
var schemaType = type.ToJsonSchemaType(); | ||
combinedType |= schemaType; | ||
} | ||
} |
Check notice
Code scanning / CodeQL
Missed opportunity to use Where Note
implicitly filters its target sequence
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 days ago
To address the issue, replace the loop:
foreach(var type in list)
{
if (type is not null)
{
// logic
}
}
with a loop that explicitly filters non-null values before iteration, using LINQ's .Where()
:
foreach(var type in list.Where(type => type is not null))
{
// logic
}
This reduces nesting, improves readability, and explicitly communicates the intent to filter out nulls. Only the relevant region inside the dictionary initializer at lines 190-210 (in the block for "type") needs changing.
No new imports or other method/variable definitions are needed, as System.Linq
is already imported.
-
Copy modified line R200 -
Copy modified lines R202-R203
@@ -197,13 +197,10 @@ | ||
{ | ||
var list = n.CreateSimpleList((n2, p) => n2.GetScalarValue(), doc); | ||
JsonSchemaType combinedType = 0; | ||
foreach(var type in list) | ||
foreach(var type in list.Where(type => type is not null)) | ||
{ | ||
if (type is not null) | ||
{ | ||
var schemaType = type.ToJsonSchemaType(); | ||
combinedType |= schemaType; | ||
} | ||
var schemaType = type.ToJsonSchemaType(); | ||
combinedType |= schemaType; | ||
} | ||
o.Type = combinedType; | ||
} |
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
…to 3 and 3.1 Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Chore/missing-v32-tests
fix: avoid serializing non-standard operations in 2, 3, and 3.1 Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
…9aa8-a50a721fd288 feat: Add support for media types components in OAS 3.2.0
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
feat: add new v32 properties for Path Items (query, additional operations)
OpenApiSpecVersion.OpenApi2_0 => _standardHttp2MethodsNames, | ||
OpenApiSpecVersion.OpenApi3_0 => _standardHttp30MethodsNames, | ||
OpenApiSpecVersion.OpenApi3_1 => _standardHttp31MethodsNames, | ||
OpenApiSpecVersion.OpenApi3_2 or _ => _standardHttp32MethodsNames, |
Check warning
Code scanning / CodeQL
Constant condition Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 days ago
The best way to fix this pattern matching issue is to restructure the switch expression to properly handle the intended cases. If OpenApiSpecVersion.OpenApi3_2
should have its own branch, then that branch should be written as a separate case. If all other enum values should fall into a generic default, then only the discard arm (_
) should be used for the fallback. In this code, to retain the ability to match OpenApiSpecVersion.OpenApi3_2
specifically, use two arms: one for that explicit value, and one (_
) as a fallback for anything else. Therefore, line 176 should be split into two lines: one matching only OpenApiSpecVersion.OpenApi3_2
, and the next with the discard pattern _
.
Edit the switch expression as follows:
- Replace line 176
withOpenApiSpecVersion.OpenApi3_2 or _ => _standardHttp32MethodsNames,
OpenApiSpecVersion.OpenApi3_2 => _standardHttp32MethodsNames, _ => _standardHttp32MethodsNames,
OR, since both branches do the same thing, just use the discard (_
) as the only branch:
_ => _standardHttp32MethodsNames
However, this latter approach may lose clarity; if the intention is to handle OpenApiSpecVersion.OpenApi3_2
specifically, splitting makes it clearer for future modifications.
No new imports or method definitions are required.
-
Copy modified lines R176-R177
@@ -173,7 +173,8 @@ | ||
OpenApiSpecVersion.OpenApi2_0 => _standardHttp2MethodsNames, | ||
OpenApiSpecVersion.OpenApi3_0 => _standardHttp30MethodsNames, | ||
OpenApiSpecVersion.OpenApi3_1 => _standardHttp31MethodsNames, | ||
OpenApiSpecVersion.OpenApi3_2 or _ => _standardHttp32MethodsNames, | ||
OpenApiSpecVersion.OpenApi3_2 => _standardHttp32MethodsNames, | ||
_ => _standardHttp32MethodsNames, | ||
}; | ||
|
||
// operations |
Signed-off-by: Vincent Biret <vincentbiret@hotmail.com>
chore: disables WPF solution on non windows platforms
docs: adds the v3 upgrade guide
closing in favour of microsoft#2529 |
No description provided.