-
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 <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
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 <[email protected]> * Complete implementation with reference support and test fixes Co-authored-by: baywet <[email protected]> * Update IOpenApiResponse to derive from IOpenApiSummarizedElement Co-authored-by: baywet <[email protected]> * Apply suggestions from code review * Apply suggestion from @baywet * chore: copy reference implementation Signed-off-by: Vincent Biret <[email protected]> * chore: adds missing using Signed-off-by: Vincent Biret <[email protected]> * chore: linting Signed-off-by: Vincent Biret <[email protected]> * chore: updates public API export Signed-off-by: Vincent Biret <[email protected]> --------- Signed-off-by: Vincent Biret <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: baywet <[email protected]> Co-authored-by: Vincent Biret <[email protected]> Co-authored-by: Vincent Biret <[email protected]>
Co-authored-by: baywet <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
chore: updates benchmark results
…e8-b196-901596c61b07
Co-authored-by: baywet <[email protected]>
…b196-901596c61b07 feat: Implement OpenAPI 3.2.0 server name field
…ization Co-authored-by: baywet <[email protected]>
Co-authored-by: baywet <[email protected]>
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 8 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 <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
…to 3 and 3.1 Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Chore/missing-v32-tests
fix: avoid serializing non-standard operations in 2, 3, and 3.1 Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
…9aa8-a50a721fd288 feat: Add support for media types components in OAS 3.2.0
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
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 6 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 <[email protected]>
chore: disables WPF solution on non windows platforms
docs: adds the v3 upgrade guide
closing in favour of microsoft#2529 |
No description provided.