Skip to content

Commit 48a24e8

Browse files
panesofglassclaude
andauthored
fix: resolve build warnings and vulnerable transitive package versions (#33)
* fix: resolve build warnings and vulnerable transitive package versions - Suppress FS0044 self-calls in deprecated schema-processor types and drop redundant upcasts (FS0066) in JsonSchema.fs - Pin System.Text.Json and Newtonsoft.Json above versions flagged by NU1903 (GHSA-8g4q-xg66-9fp4, GHSA-5crp-9r3c-p9vr) - Bump Expecto to 9.0.4 to clear the NU1605 downgrade warning against Verify.Expecto's floor - Bump Microsoft.NET.Test.Sdk 16.8.0 -> 17.14.1 across test projects, removing its vulnerable transitive Newtonsoft.Json 9.0.1 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: scope FS0044 suppression to actual self-call sites Marking each interface-impl member [<Obsolete>] doesn't suppress the warning for calling another Obsolete member in F# (unlike C#'s CS0618 behavior) - verified it still fired at all 5 sites. Use line-scoped #nowarn/#warnon "44" pragmas instead, bounded to each call, so unrelated future obsolete-API misuse in this file still warns. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 6e0d8e8 commit 48a24e8

7 files changed

Lines changed: 52 additions & 8 deletions

File tree

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,10 @@ TestResult.xml
199199

200200
tmp.*
201201
solutions/
202+
203+
# AI
204+
.claude/
205+
!.claude/agents/
206+
!.claude/commands/
207+
!.claude/skills/
208+
!.claude/settings.json

src/FSharp.Data.JsonSchema.Core/FSharp.Data.JsonSchema.Core.fsproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,14 @@
1616
<PackageReference Include="FSharp.SystemTextJson" Version="1.1.23" />
1717
</ItemGroup>
1818

19+
<!-- Explicit floors above FSharp.SystemTextJson's transitive default (System.Text.Json 6.0.0),
20+
which is affected by GHSA-8g4q-xg66-9fp4 (denial of service in JsonSerializer). 8.0.6 drops
21+
netcoreapp3.1 support, so that TFM pins to the 6.x line's patched release instead. -->
22+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
23+
<PackageReference Include="System.Text.Json" Version="6.0.10" />
24+
</ItemGroup>
25+
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
26+
<PackageReference Include="System.Text.Json" Version="8.0.6" />
27+
</ItemGroup>
28+
1929
</Project>

src/FSharp.Data.JsonSchema.NJsonSchema/FSharp.Data.JsonSchema.NJsonSchema.fsproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,17 @@
1717
<PackageReference Include="FSharp.SystemTextJson" Version="1.1.23" />
1818
<PackageReference Include="NJsonSchema" Version="10.*" />
1919
<PackageReference Include="System.ComponentModel.Annotations" Version="5.*" Condition="'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'netcoreapp3.1'" />
20+
<!-- Explicit floor above NJsonSchema's transitive default (Newtonsoft.Json 9.0.1),
21+
which is affected by GHSA-5crp-9r3c-p9vr. -->
22+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
23+
</ItemGroup>
24+
<!-- Explicit floors above FSharp.SystemTextJson's transitive default (System.Text.Json 6.0.0),
25+
which is affected by GHSA-8g4q-xg66-9fp4. 8.0.6 drops netcoreapp3.1 support, so that TFM
26+
pins to the 6.x line's patched release instead. -->
27+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
28+
<PackageReference Include="System.Text.Json" Version="6.0.10" />
29+
</ItemGroup>
30+
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
31+
<PackageReference Include="System.Text.Json" Version="8.0.6" />
2032
</ItemGroup>
2133
</Project>

src/FSharp.Data.JsonSchema.NJsonSchema/JsonSchema.fs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ type OptionSchemaProcessor() =
8282
schema.Type <- schemaType
8383

8484
interface ISchemaProcessor with
85+
// FS0044: delegates to the type's own (also Obsolete) Process member.
86+
#nowarn "44"
8587
member this.Process(context) = this.Process(context)
88+
#warnon "44"
8689

8790
[<Obsolete("No longer used internally. Use FSharp.Data.JsonSchema.Core.SchemaAnalyzer instead.")>]
8891
type SingleCaseDuSchemaProcessor() =
@@ -102,7 +105,10 @@ type SingleCaseDuSchemaProcessor() =
102105
schema.EnumerationNames.Add(case.Name)
103106

104107
interface ISchemaProcessor with
108+
// FS0044: delegates to the type's own (also Obsolete) Process member.
109+
#nowarn "44"
105110
member this.Process(context) = this.Process(context)
111+
#warnon "44"
106112

107113
[<Obsolete("No longer used internally. Use FSharp.Data.JsonSchema.Core.SchemaAnalyzer instead.")>]
108114
type MultiCaseDuSchemaProcessor(?casePropertyName) =
@@ -200,15 +206,21 @@ type MultiCaseDuSchemaProcessor(?casePropertyName) =
200206
s.RequiredProperties.Add(camelCaseFieldName)
201207
s
202208

203-
// Attach each case definition.
209+
// Attach each case definition. FS0044: Dictionary is Obsolete but still the
210+
// internal helper this Obsolete processor type relies on.
211+
#nowarn "44"
204212
let name = Dictionary.getUniqueKey schema.Definitions case.Name
213+
#warnon "44"
205214
// printfn "Adding case %s to dict: %A" name schema.Definitions
206215
schema.Definitions.Add(name, caseSchema)
207216
// Add each schema to the anyOf collection.
208217
schema.AnyOf.Add(JsonSchema(Reference = caseSchema))
209218

210219
interface ISchemaProcessor with
220+
// FS0044: delegates to the type's own (also Obsolete) Process member.
221+
#nowarn "44"
211222
member this.Process(context) = this.Process(context)
223+
#warnon "44"
212224

213225

214226
[<Obsolete("No longer used internally. Use FSharp.Data.JsonSchema.Core.SchemaAnalyzer instead.")>]
@@ -230,7 +242,10 @@ type RecordSchemaProcessor() =
230242
property.IsRequired <- true
231243

232244
interface ISchemaProcessor with
245+
// FS0044: delegates to the type's own (also Obsolete) Process member.
246+
#nowarn "44"
233247
member this.Process(context) = this.Process(context)
248+
#warnon "44"
234249

235250

236251

@@ -332,8 +347,8 @@ type Generator private () =
332347
| :? System.ComponentModel.DataAnnotations.MaxLengthAttribute as ml ->
333348
prop.MaxLength <- Nullable ml.Length
334349
| :? System.ComponentModel.DataAnnotations.RangeAttribute as r ->
335-
prop.Minimum <- Nullable (Convert.ToDecimal(r.Minimum :> obj))
336-
prop.Maximum <- Nullable (Convert.ToDecimal(r.Maximum :> obj))
350+
prop.Minimum <- Nullable (Convert.ToDecimal r.Minimum)
351+
prop.Maximum <- Nullable (Convert.ToDecimal r.Maximum)
337352
| _ -> ()
338353
| _ -> ()
339354
applyAnnotations ty schema

test/FSharp.Data.JsonSchema.Core.Tests/FSharp.Data.JsonSchema.Core.Tests.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
<Compile Include="Main.fs" />
1515
</ItemGroup>
1616
<ItemGroup>
17-
<PackageReference Include="Expecto" Version="9.0.2" />
17+
<PackageReference Include="Expecto" Version="9.0.4" />
1818
<PackageReference Include="GitHubActionsTestLogger" Version="1.1.0" />
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
2020
<PackageReference Include="Verify.Expecto" Version="20.3.2" />
2121
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.9.2" />
2222
</ItemGroup>

test/FSharp.Data.JsonSchema.OpenApi.Tests/FSharp.Data.JsonSchema.OpenApi.Tests.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<ItemGroup>
2222
<PackageReference Include="Expecto" Version="9.0.2" />
2323
<PackageReference Include="GitHubActionsTestLogger" Version="1.1.0" />
24-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
24+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
2525
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.9.2" />
2626
</ItemGroup>
2727
</Project>

test/FSharp.Data.JsonSchema.Tests/FSharp.Data.JsonSchema.Tests.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<Compile Include="Main.fs" />
1818
</ItemGroup>
1919
<ItemGroup>
20-
<PackageReference Include="Expecto" Version="9.0.2" />
20+
<PackageReference Include="Expecto" Version="9.0.4" />
2121
<PackageReference Include="GitHubActionsTestLogger" Version="1.1.0" />
22-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
22+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
2323
<PackageReference Include="Verify.ClipboardAccept" Version="20.3.2" />
2424
<PackageReference Include="Verify.DiffPlex" Version="2.2.1" />
2525
<PackageReference Include="Verify.Expecto" Version="20.3.2" />

0 commit comments

Comments
 (0)