Skip to content

Conversation

@sergey-tihon
Copy link
Member

@sergey-tihon sergey-tihon commented Aug 31, 2025

@sergey-tihon sergey-tihon changed the title feat: update dependencies WIP: Microsoft.OpenApi v2.3.0 with OpenAPI v3.1 Support Aug 31, 2025
Copilot AI review requested due to automatic review settings October 11, 2025 22:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades Microsoft.OpenApi from v2.x to v2.3.0 to add OpenAPI v3.1 support, removing the separate Microsoft.OpenApi.Readers dependency and updating various dependencies.

Key changes:

  • Updated OpenAPI library dependencies and added OpenAPI v3.1 support
  • Refactored code to use new OpenAPI library interfaces and APIs
  • Modernized F# syntax with abbreviated lambda expressions

Reviewed Changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
paket.dependencies Updated FSharp.Core, System.Text.Json, and OpenAPI packages; added Swashbuckle preview
src/SwaggerProvider.DesignTime/v3/DefinitionCompiler.fs Adapted to new IOpenApiSchema interface and JsonSchemaType enum
src/SwaggerProvider.DesignTime/v3/OperationCompiler.fs Updated to use IOpenApiPathItem and IOpenApiParameter interfaces
tests/Swashbuckle.WebApi.Server/Startup.fs Replaced SerializeAsV2 with OpenApiVersion property
tests/SwaggerProvider.Tests/Schema.Parser.Tests.fs Updated OpenAPI document parsing to use new API
src/SwaggerProvider.DesignTime/Provider.OpenApiClient.fs Updated schema reading to use new OpenAPI parsing methods
Multiple files Applied F# syntax modernization and version updates

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 392 to 407
// If schemaObj.Type is missing, but allOf is present and first allOf subschema has a type, use that
if
not schemaObj.Type.HasValue
&& not(isNull schemaObj.AllOf)
&& schemaObj.AllOf.Count > 0
then
let firstAllOf = schemaObj.AllOf.[0]

if not(isNull firstAllOf) && firstAllOf.Type.HasValue then
Some firstAllOf.Type.Value
else
None
else if schemaObj.Type.HasValue then
Some schemaObj.Type.Value
else
None
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code accesses schemaObj.AllOf.[0] without null checking schemaObj.AllOf first. While there's a count check, if schemaObj.AllOf is null, Count property access will throw a NullReferenceException.

Copilot uses AI. Check for mistakes.
@sergey-tihon sergey-tihon changed the title WIP: Microsoft.OpenApi v2.3.0 with OpenAPI v3.1 Support WIP: Microsoft.OpenApi v2.x (OpenAPI v3.1 Support) and .NET 10 Nov 16, 2025
@sergey-tihon sergey-tihon requested a review from Copilot December 24, 2025 08:24
@sergey-tihon sergey-tihon changed the title WIP: Microsoft.OpenApi v2.x (OpenAPI v3.1 Support) and .NET 10 feat: Microsoft.OpenApi v2.x (OpenAPI v3.1 Support) and .NET 10 Dec 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 29 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

tests/SwaggerProvider.Tests/Schema.Parser.Tests.fs:36

  • The diagnostic error checking code is commented out (lines 32-36). If the diagnostic errors are no longer being checked after the migration to OpenApi v2.x, this could lead to silent parsing failures. Either remove the commented code if it's no longer needed, or provide an explanation for why error checking has been disabled. If the API for checking diagnostics has changed, update the code to use the new API.
        (*        if diagnostic.Errors.Count > 0 then
               failwithf "Schema parse errors:\n- %s"
                   (diagnostic.Errors
                    |> Seq.map (fun e -> e.Message)
                    |> String.concat ";\n- ")*)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 172 to 175
// NOTE: Dictionary tests removed because Swashbuckle doesn't generate 'additionalProperties' in Swagger 2.0 for dictionaries
// The swagger.json produces: {"type": "object"} instead of {"type": "object", "additionalProperties": {"$ref": "#/definitions/PointClass"}}
// The corresponding OpenAPI 3.0 tests in v3/Swashbuckle.ReturnControllers.Tests.fs cover this functionality
// See: tests/SwaggerProvider.ProviderTests/v3/Swashbuckle.ReturnControllers.Tests.fs for working dictionary tests
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "Swashbuckle doesn't generate 'additionalProperties' in Swagger 2.0 for dictionaries". However, if the tests have been removed due to a known limitation in the test server setup rather than an actual issue in SwaggerProvider itself, this should be made clearer. Consider adding information about whether this is a temporary workaround and if there's a plan to re-enable these tests once Swashbuckle is fixed, or if this represents a permanent limitation.

Suggested change
// NOTE: Dictionary tests removed because Swashbuckle doesn't generate 'additionalProperties' in Swagger 2.0 for dictionaries
// The swagger.json produces: {"type": "object"} instead of {"type": "object", "additionalProperties": {"$ref": "#/definitions/PointClass"}}
// The corresponding OpenAPI 3.0 tests in v3/Swashbuckle.ReturnControllers.Tests.fs cover this functionality
// See: tests/SwaggerProvider.ProviderTests/v3/Swashbuckle.ReturnControllers.Tests.fs for working dictionary tests
// NOTE: Dictionary tests for the Swagger 2.0 endpoint are disabled here because the Swashbuckle test server
// (and its Swagger 2.0 generator) does not emit 'additionalProperties' for dictionary types.
// The generated swagger.json currently contains: {"type": "object"} instead of
// {"type": "object", "additionalProperties": {"$ref": "#/definitions/PointClass"}}.
// This is a limitation of the Swashbuckle/Swagger 2.0 test setup, not of SwaggerProvider itself.
// The corresponding OpenAPI 3.0 tests in v3/Swashbuckle.ReturnControllers.Tests.fs validate dictionary support.
// See: tests/SwaggerProvider.ProviderTests/v3/Swashbuckle.ReturnControllers.Tests.fs for working dictionary tests.
// If Swashbuckle's Swagger 2.0 generator is ever updated to emit 'additionalProperties' correctly,
// these v2 dictionary-return tests can be re-enabled.

Copilot uses AI. Check for mistakes.
@sergey-tihon sergey-tihon merged commit eba398d into master Dec 24, 2025
1 check passed
@sergey-tihon sergey-tihon deleted the feat/deps branch December 24, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants