From 4b9254965681f0393e0642861b9e8104cea80e68 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 24 Mar 2026 16:40:53 +0000 Subject: [PATCH 1/8] test: add $ref primitive-type alias tests for v3 DefinitionCompiler Add 8 new tests to Schema.TypeMappingTests.fs verifying that component schemas which are primitive-type aliases (e.g. `PhoneNumber: type: string`) resolve to the correct .NET type when referenced via direct `$ref` or `allOf: [$ref]`. Two new helper functions: - `compileDirectRefType`: compiles a property that directly $ref's a component alias - `compileAllOfRefType`: compiles a property using allOf:[$ref] (standard OAS 3.0 pattern) Tests cover: string, integer (int32), integer/int64, number (float32), boolean, string/uuid (Guid), allOf-string, allOf-integer. Related to issue #163. Addresses the test part of issue #335. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../v3/Schema.TypeMappingTests.fs | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs b/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs index 6b77d7a..05fb0de 100644 --- a/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs +++ b/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs @@ -208,3 +208,164 @@ let ``optional byte array is not wrapped in Option``() = // byte[*] is a reference type — not wrapped in Option ty |> shouldEqual(typeof.MakeArrayType(1)) + +// ── $ref primitive-type alias helpers ──────────────────────────────────────── + +/// Compile a schema where `TestType.Value` directly references a component alias schema +/// (e.g., `$ref: '#/components/schemas/AliasType'`) and return the resolved .NET type. +let private compileDirectRefType (aliasYaml: string) : Type = + let schemaStr = + sprintf + """openapi: "3.0.0" +info: + title: RefAliasTest + version: "1.0.0" +paths: {} +components: + schemas: + AliasType: +%s TestType: + type: object + required: + - Value + properties: + Value: + $ref: '#/components/schemas/AliasType' +""" + aliasYaml + + let settings = OpenApiReaderSettings() + settings.AddYamlReader() + + let readResult = + Microsoft.OpenApi.OpenApiDocument.Parse(schemaStr, settings = settings) + + match readResult.Diagnostic with + | null -> () + | diagnostic when diagnostic.Errors |> Seq.isEmpty |> not -> + let errorText = + diagnostic.Errors + |> Seq.map string + |> String.concat Environment.NewLine + + failwithf "Failed to parse OpenAPI schema:%s%s" Environment.NewLine errorText + | _ -> () + + let schema = + match readResult.Document with + | null -> failwith "Failed to parse OpenAPI schema: Document is null." + | doc -> doc + + let defCompiler = DefinitionCompiler(schema, false) + let opCompiler = OperationCompiler(schema, defCompiler, true, false, true) + opCompiler.CompileProvidedClients(defCompiler.Namespace) + + let types = defCompiler.Namespace.GetProvidedTypes() + let testType = types |> List.find(fun t -> t.Name = "TestType") + + match testType.GetDeclaredProperty("Value") with + | null -> failwith "Property 'Value' not found on TestType" + | prop -> prop.PropertyType + +/// Compile a schema where `TestType.Value` uses `allOf: [$ref]` to reference a component alias +/// (the standard OpenAPI 3.0 pattern for annotating a reference) and return the resolved .NET type. +let private compileAllOfRefType (aliasYaml: string) : Type = + let schemaStr = + sprintf + """openapi: "3.0.0" +info: + title: AllOfRefAliasTest + version: "1.0.0" +paths: {} +components: + schemas: + AliasType: +%s TestType: + type: object + required: + - Value + properties: + Value: + allOf: + - $ref: '#/components/schemas/AliasType' +""" + aliasYaml + + let settings = OpenApiReaderSettings() + settings.AddYamlReader() + + let readResult = + Microsoft.OpenApi.OpenApiDocument.Parse(schemaStr, settings = settings) + + match readResult.Diagnostic with + | null -> () + | diagnostic when diagnostic.Errors |> Seq.isEmpty |> not -> + let errorText = + diagnostic.Errors + |> Seq.map string + |> String.concat Environment.NewLine + + failwithf "Failed to parse OpenAPI schema:%s%s" Environment.NewLine errorText + | _ -> () + + let schema = + match readResult.Document with + | null -> failwith "Failed to parse OpenAPI schema: Document is null." + | doc -> doc + + let defCompiler = DefinitionCompiler(schema, false) + let opCompiler = OperationCompiler(schema, defCompiler, true, false, true) + opCompiler.CompileProvidedClients(defCompiler.Namespace) + + let types = defCompiler.Namespace.GetProvidedTypes() + let testType = types |> List.find(fun t -> t.Name = "TestType") + + match testType.GetDeclaredProperty("Value") with + | null -> failwith "Property 'Value' not found on TestType" + | prop -> prop.PropertyType + +// ── $ref to primitive-type alias (direct $ref) ─────────────────────────────── + +[] +let ``direct $ref to string alias resolves to string``() = + let ty = compileDirectRefType " type: string\n" + ty |> shouldEqual typeof + +[] +let ``direct $ref to integer alias resolves to int32``() = + let ty = compileDirectRefType " type: integer\n" + ty |> shouldEqual typeof + +[] +let ``direct $ref to int64 alias resolves to int64``() = + let ty = compileDirectRefType " type: integer\n format: int64\n" + ty |> shouldEqual typeof + +[] +let ``direct $ref to number alias resolves to float32``() = + let ty = compileDirectRefType " type: number\n" + ty |> shouldEqual typeof + +[] +let ``direct $ref to boolean alias resolves to bool``() = + let ty = compileDirectRefType " type: boolean\n" + ty |> shouldEqual typeof + +[] +let ``direct $ref to uuid string alias resolves to Guid``() = + let ty = compileDirectRefType " type: string\n format: uuid\n" + ty |> shouldEqual typeof + +// ── $ref to primitive-type alias (via allOf wrapper) ───────────────────────── +// allOf: [$ref] is the standard OpenAPI 3.0 pattern for annotating a $ref with +// additional constraints (e.g. description, nullable) without repeating the schema. + +[] +let ``allOf $ref to string alias resolves to string``() = + let ty = compileAllOfRefType " type: string\n" + ty |> shouldEqual typeof + +[] +let ``allOf $ref to integer alias resolves to int32``() = + let ty = compileAllOfRefType " type: integer\n" + ty |> shouldEqual typeof From 3adb50fb54d00448839877bbb67720e06118ff22 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 24 Mar 2026 16:46:47 +0000 Subject: [PATCH 2/8] ci: trigger checks From 18c70bd71216a19a902989678af01b1143b8acf0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:42:22 +0000 Subject: [PATCH 3/8] fix: apply Fantomas formatting to fix CheckFormat CI failure Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com> Agent-Logs-Url: https://github.com/fsprojects/SwaggerProvider/sessions/0d9e2ea5-87e2-4c38-be5d-f4ff338cfe71 --- tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs b/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs index 05fb0de..6409f70 100644 --- a/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs +++ b/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs @@ -213,7 +213,7 @@ let ``optional byte array is not wrapped in Option``() = /// Compile a schema where `TestType.Value` directly references a component alias schema /// (e.g., `$ref: '#/components/schemas/AliasType'`) and return the resolved .NET type. -let private compileDirectRefType (aliasYaml: string) : Type = +let private compileDirectRefType(aliasYaml: string) : Type = let schemaStr = sprintf """openapi: "3.0.0" @@ -269,7 +269,7 @@ components: /// Compile a schema where `TestType.Value` uses `allOf: [$ref]` to reference a component alias /// (the standard OpenAPI 3.0 pattern for annotating a reference) and return the resolved .NET type. -let private compileAllOfRefType (aliasYaml: string) : Type = +let private compileAllOfRefType(aliasYaml: string) : Type = let schemaStr = sprintf """openapi: "3.0.0" From 4ace73822013735487087ba53adb7131f0b906f3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 19:07:00 +0000 Subject: [PATCH 4/8] refactor: address review comments in alias tests - Extract shared compileSchemaAndGetValueType helper to remove duplicated parse/compile/reflect logic from compilePropertyType, compileDirectRefType, and compileAllOfRefType - Make aliasYaml template robust using TrimEnd() + explicit newline to prevent malformed YAML if caller omits trailing newline - Add required: bool parameter to compileDirectRefType and compileAllOfRefType to support both required and optional cases - Add 4 optional alias-ref tests (direct and allOf, int32 and int64) verifying value-type aliases are wrapped in Option when the property is non-required Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../v3/Schema.TypeMappingTests.fs | 194 ++++++++---------- 1 file changed, 85 insertions(+), 109 deletions(-) diff --git a/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs b/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs index 6409f70..7276592 100644 --- a/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs +++ b/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs @@ -6,39 +6,15 @@ open SwaggerProvider.Internal.v3.Compilers open Xunit open FsUnitTyped -/// Compile a minimal OpenAPI v3 schema containing one "TestType" object with a single -/// "Value" property defined by `propYaml`, and return that property's compiled .NET type. -let private compilePropertyType (propYaml: string) (required: bool) : Type = - let requiredBlock = - if required then - " required:\n - Value\n" - else - "" - - let schemaStr = - sprintf - """openapi: "3.0.0" -info: - title: TypeMappingTest - version: "1.0.0" -paths: {} -components: - schemas: - TestType: - type: object -%s properties: - Value: -%s""" - requiredBlock - propYaml - +/// Parse and compile a full OpenAPI v3 schema string, then return the .NET type of +/// the `Value` property on the `TestType` component schema. +let private compileSchemaAndGetValueType (schemaStr: string) : Type = let settings = OpenApiReaderSettings() settings.AddYamlReader() let readResult = Microsoft.OpenApi.OpenApiDocument.Parse(schemaStr, settings = settings) - // Ensure the schema was parsed successfully before using it match readResult.Diagnostic with | null -> () | diagnostic when diagnostic.Errors |> Seq.isEmpty |> not -> @@ -66,6 +42,34 @@ components: | null -> failwith "Property 'Value' not found on TestType" | prop -> prop.PropertyType +/// Compile a minimal OpenAPI v3 schema containing one "TestType" object with a single +/// "Value" property defined by `propYaml`, and return that property's compiled .NET type. +let private compilePropertyType (propYaml: string) (required: bool) : Type = + let requiredBlock = + if required then + " required:\n - Value\n" + else + "" + + let schemaStr = + sprintf + """openapi: "3.0.0" +info: + title: TypeMappingTest + version: "1.0.0" +paths: {} +components: + schemas: + TestType: + type: object +%s properties: + Value: +%s""" + requiredBlock + propYaml + + compileSchemaAndGetValueType schemaStr + // ── Required primitive types ───────────────────────────────────────────────── [] @@ -213,7 +217,13 @@ let ``optional byte array is not wrapped in Option``() = /// Compile a schema where `TestType.Value` directly references a component alias schema /// (e.g., `$ref: '#/components/schemas/AliasType'`) and return the resolved .NET type. -let private compileDirectRefType(aliasYaml: string) : Type = +let private compileDirectRefType (aliasYaml: string) (required: bool) : Type = + let requiredBlock = + if required then + " required:\n - Value\n" + else + "" + let schemaStr = sprintf """openapi: "3.0.0" @@ -226,50 +236,24 @@ components: AliasType: %s TestType: type: object - required: - - Value - properties: +%s properties: Value: $ref: '#/components/schemas/AliasType' """ - aliasYaml - - let settings = OpenApiReaderSettings() - settings.AddYamlReader() - - let readResult = - Microsoft.OpenApi.OpenApiDocument.Parse(schemaStr, settings = settings) - - match readResult.Diagnostic with - | null -> () - | diagnostic when diagnostic.Errors |> Seq.isEmpty |> not -> - let errorText = - diagnostic.Errors - |> Seq.map string - |> String.concat Environment.NewLine - - failwithf "Failed to parse OpenAPI schema:%s%s" Environment.NewLine errorText - | _ -> () - - let schema = - match readResult.Document with - | null -> failwith "Failed to parse OpenAPI schema: Document is null." - | doc -> doc - - let defCompiler = DefinitionCompiler(schema, false) - let opCompiler = OperationCompiler(schema, defCompiler, true, false, true) - opCompiler.CompileProvidedClients(defCompiler.Namespace) - - let types = defCompiler.Namespace.GetProvidedTypes() - let testType = types |> List.find(fun t -> t.Name = "TestType") + (aliasYaml.TrimEnd() + "\n") + requiredBlock - match testType.GetDeclaredProperty("Value") with - | null -> failwith "Property 'Value' not found on TestType" - | prop -> prop.PropertyType + compileSchemaAndGetValueType schemaStr /// Compile a schema where `TestType.Value` uses `allOf: [$ref]` to reference a component alias /// (the standard OpenAPI 3.0 pattern for annotating a reference) and return the resolved .NET type. -let private compileAllOfRefType(aliasYaml: string) : Type = +let private compileAllOfRefType (aliasYaml: string) (required: bool) : Type = + let requiredBlock = + if required then + " required:\n - Value\n" + else + "" + let schemaStr = sprintf """openapi: "3.0.0" @@ -282,78 +266,46 @@ components: AliasType: %s TestType: type: object - required: - - Value - properties: +%s properties: Value: allOf: - $ref: '#/components/schemas/AliasType' """ - aliasYaml - - let settings = OpenApiReaderSettings() - settings.AddYamlReader() - - let readResult = - Microsoft.OpenApi.OpenApiDocument.Parse(schemaStr, settings = settings) - - match readResult.Diagnostic with - | null -> () - | diagnostic when diagnostic.Errors |> Seq.isEmpty |> not -> - let errorText = - diagnostic.Errors - |> Seq.map string - |> String.concat Environment.NewLine - - failwithf "Failed to parse OpenAPI schema:%s%s" Environment.NewLine errorText - | _ -> () - - let schema = - match readResult.Document with - | null -> failwith "Failed to parse OpenAPI schema: Document is null." - | doc -> doc - - let defCompiler = DefinitionCompiler(schema, false) - let opCompiler = OperationCompiler(schema, defCompiler, true, false, true) - opCompiler.CompileProvidedClients(defCompiler.Namespace) + (aliasYaml.TrimEnd() + "\n") + requiredBlock - let types = defCompiler.Namespace.GetProvidedTypes() - let testType = types |> List.find(fun t -> t.Name = "TestType") - - match testType.GetDeclaredProperty("Value") with - | null -> failwith "Property 'Value' not found on TestType" - | prop -> prop.PropertyType + compileSchemaAndGetValueType schemaStr // ── $ref to primitive-type alias (direct $ref) ─────────────────────────────── [] let ``direct $ref to string alias resolves to string``() = - let ty = compileDirectRefType " type: string\n" + let ty = compileDirectRefType " type: string\n" true ty |> shouldEqual typeof [] let ``direct $ref to integer alias resolves to int32``() = - let ty = compileDirectRefType " type: integer\n" + let ty = compileDirectRefType " type: integer\n" true ty |> shouldEqual typeof [] let ``direct $ref to int64 alias resolves to int64``() = - let ty = compileDirectRefType " type: integer\n format: int64\n" + let ty = compileDirectRefType " type: integer\n format: int64\n" true ty |> shouldEqual typeof [] let ``direct $ref to number alias resolves to float32``() = - let ty = compileDirectRefType " type: number\n" + let ty = compileDirectRefType " type: number\n" true ty |> shouldEqual typeof [] let ``direct $ref to boolean alias resolves to bool``() = - let ty = compileDirectRefType " type: boolean\n" + let ty = compileDirectRefType " type: boolean\n" true ty |> shouldEqual typeof [] let ``direct $ref to uuid string alias resolves to Guid``() = - let ty = compileDirectRefType " type: string\n format: uuid\n" + let ty = compileDirectRefType " type: string\n format: uuid\n" true ty |> shouldEqual typeof // ── $ref to primitive-type alias (via allOf wrapper) ───────────────────────── @@ -362,10 +314,34 @@ let ``direct $ref to uuid string alias resolves to Guid``() = [] let ``allOf $ref to string alias resolves to string``() = - let ty = compileAllOfRefType " type: string\n" + let ty = compileAllOfRefType " type: string\n" true ty |> shouldEqual typeof [] let ``allOf $ref to integer alias resolves to int32``() = - let ty = compileAllOfRefType " type: integer\n" + let ty = compileAllOfRefType " type: integer\n" true ty |> shouldEqual typeof + +// ── Optional $ref to primitive-type alias ───────────────────────────────────── +// When a $ref/allOf alias property is non-required, value types must be wrapped +// in Option consistent with the behaviour of ordinary optional primitive properties. + +[] +let ``optional direct $ref to integer alias resolves to Option``() = + let ty = compileDirectRefType " type: integer\n" false + ty |> shouldEqual typeof + +[] +let ``optional direct $ref to int64 alias resolves to Option``() = + let ty = compileDirectRefType " type: integer\n format: int64\n" false + ty |> shouldEqual typeof + +[] +let ``optional allOf $ref to integer alias resolves to Option``() = + let ty = compileAllOfRefType " type: integer\n" false + ty |> shouldEqual typeof + +[] +let ``optional allOf $ref to int64 alias resolves to Option``() = + let ty = compileAllOfRefType " type: integer\n format: int64\n" false + ty |> shouldEqual typeof From 76c029b9b9edd8f88bde3601743855785d9cdf02 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Tue, 24 Mar 2026 23:27:25 +0100 Subject: [PATCH 5/8] fix: formatting --- tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs b/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs index 7276592..7a9f784 100644 --- a/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs +++ b/tests/SwaggerProvider.Tests/v3/Schema.TypeMappingTests.fs @@ -8,7 +8,7 @@ open FsUnitTyped /// Parse and compile a full OpenAPI v3 schema string, then return the .NET type of /// the `Value` property on the `TestType` component schema. -let private compileSchemaAndGetValueType (schemaStr: string) : Type = +let private compileSchemaAndGetValueType(schemaStr: string) : Type = let settings = OpenApiReaderSettings() settings.AddYamlReader() From 8c4c9c7e30646815c74661a176f47eee1bd67f25 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 05:41:54 +0000 Subject: [PATCH 6/8] fix: skip GitHub API tests gracefully when rate limit exceeded --- .../v2/Swagger.GitHub.Tests.fs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs b/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs index df0e56a..ff75a60 100644 --- a/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs +++ b/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs @@ -41,16 +41,29 @@ let taskGitHub() = client +let isRateLimitError (ex: exn) = + ex.Message.Contains("rate limit") || ex.Message.Contains("403 (rate limit") + [] // Explicit let ``Get fsprojects from GitHub``() = task { - let! repos = github().OrgRepos("fsprojects") - repos.Length |> shouldBeGreaterThan 0 + try + let! repos = github().OrgRepos("fsprojects") + repos.Length |> shouldBeGreaterThan 0 + with :? HttpRequestException as ex when isRateLimitError ex -> + Skip.Always("GitHub API rate limit exceeded - transient CI failure") + | :? AggregateException as aex when isRateLimitError aex -> + Skip.Always("GitHub API rate limit exceeded - transient CI failure") } [] let ``Get fsproject from GitHub with Task``() = task { - let! repos = taskGitHub().OrgRepos("fsprojects") - repos.Length |> shouldBeGreaterThan 0 + try + let! repos = taskGitHub().OrgRepos("fsprojects") + repos.Length |> shouldBeGreaterThan 0 + with :? HttpRequestException as ex when isRateLimitError ex -> + Skip.Always("GitHub API rate limit exceeded - transient CI failure") + | :? AggregateException as aex when isRateLimitError aex -> + Skip.Always("GitHub API rate limit exceeded - transient CI failure") } From 8c43bcaf90ed57667639c1787df161671121f8ec Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Wed, 25 Mar 2026 07:25:56 +0100 Subject: [PATCH 7/8] fix: formatting --- .../v2/Swagger.GitHub.Tests.fs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs b/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs index ff75a60..68782b0 100644 --- a/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs +++ b/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs @@ -41,8 +41,9 @@ let taskGitHub() = client -let isRateLimitError (ex: exn) = - ex.Message.Contains("rate limit") || ex.Message.Contains("403 (rate limit") +let isRateLimitError(ex: exn) = + ex.Message.Contains("rate limit") + || ex.Message.Contains("403 (rate limit") [] // Explicit let ``Get fsprojects from GitHub``() = @@ -50,10 +51,9 @@ let ``Get fsprojects from GitHub``() = try let! repos = github().OrgRepos("fsprojects") repos.Length |> shouldBeGreaterThan 0 - with :? HttpRequestException as ex when isRateLimitError ex -> - Skip.Always("GitHub API rate limit exceeded - transient CI failure") - | :? AggregateException as aex when isRateLimitError aex -> - Skip.Always("GitHub API rate limit exceeded - transient CI failure") + with + | :? HttpRequestException as ex when isRateLimitError ex -> Skip.Always("GitHub API rate limit exceeded - transient CI failure") + | :? AggregateException as aex when isRateLimitError aex -> Skip.Always("GitHub API rate limit exceeded - transient CI failure") } [] @@ -62,8 +62,7 @@ let ``Get fsproject from GitHub with Task``() = try let! repos = taskGitHub().OrgRepos("fsprojects") repos.Length |> shouldBeGreaterThan 0 - with :? HttpRequestException as ex when isRateLimitError ex -> - Skip.Always("GitHub API rate limit exceeded - transient CI failure") - | :? AggregateException as aex when isRateLimitError aex -> - Skip.Always("GitHub API rate limit exceeded - transient CI failure") + with + | :? HttpRequestException as ex when isRateLimitError ex -> Skip.Always("GitHub API rate limit exceeded - transient CI failure") + | :? AggregateException as aex when isRateLimitError aex -> Skip.Always("GitHub API rate limit exceeded - transient CI failure") } From a97fdee76f475f47d03f1d90ff5af5335b38d513 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Wed, 25 Mar 2026 07:44:40 +0100 Subject: [PATCH 8/8] fix: syntax --- .../v2/Swagger.GitHub.Tests.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs b/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs index 68782b0..fd52c87 100644 --- a/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs +++ b/tests/SwaggerProvider.ProviderTests/v2/Swagger.GitHub.Tests.fs @@ -52,8 +52,8 @@ let ``Get fsprojects from GitHub``() = let! repos = github().OrgRepos("fsprojects") repos.Length |> shouldBeGreaterThan 0 with - | :? HttpRequestException as ex when isRateLimitError ex -> Skip.Always("GitHub API rate limit exceeded - transient CI failure") - | :? AggregateException as aex when isRateLimitError aex -> Skip.Always("GitHub API rate limit exceeded - transient CI failure") + | :? HttpRequestException as ex when isRateLimitError ex -> Assert.Skip("GitHub API rate limit exceeded - transient CI failure") + | :? AggregateException as aex when isRateLimitError aex -> Assert.Skip("GitHub API rate limit exceeded - transient CI failure") } [] @@ -63,6 +63,6 @@ let ``Get fsproject from GitHub with Task``() = let! repos = taskGitHub().OrgRepos("fsprojects") repos.Length |> shouldBeGreaterThan 0 with - | :? HttpRequestException as ex when isRateLimitError ex -> Skip.Always("GitHub API rate limit exceeded - transient CI failure") - | :? AggregateException as aex when isRateLimitError aex -> Skip.Always("GitHub API rate limit exceeded - transient CI failure") + | :? HttpRequestException as ex when isRateLimitError ex -> Assert.Skip("GitHub API rate limit exceeded - transient CI failure") + | :? AggregateException as aex when isRateLimitError aex -> Assert.Skip("GitHub API rate limit exceeded - transient CI failure") }