build(deps): bump Microsoft.OpenApi to 3.10.0 - #8050
Conversation
3.10.0 obsoletes IOpenApiSchema.Example in favour of Examples, which is an error under our warnaserror settings. The one usage is the schema copy in PluginsGenerationService, so it now copies Examples. Verified the anyOf handling is unaffected: the plugin manifest test still sees AnyOf populated on the source document, and the whole suite is green on 3.10.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VUifZksSV3pi2zWxvs29ka
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
|
Thanks for opening this pull request! Please add a changelog entry under |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VUifZksSV3pi2zWxvs29ka
Head branch was pushed to by a user without write access
3.10.0 folds a union of primitive types, anyOf: [string, integer], into a single Type carrying both flags and clears AnyOf, so SelectFirstAnyOneOfVisitor never sees the union and the generated plugin description kept the multi-valued type. I missed this in the bump commit because the local test host was crashing partway through the run and still reporting the completed tests as passing. NarrowMultipleTypes collapses it back to a single type. A numeric type paired with a string and a numeric format is what System.Text.Json's JsonNumberHandling.AllowReadingFromString advertises, so the numeric type wins there, matching what GetPrimitiveType already does for clients. Otherwise the string wins. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VUifZksSV3pi2zWxvs29ka
Head branch was pushed to by a user without write access
|
Correction, and it changes this PR materially, so please re-review rather than relying on the earlier approval. I was wrong that 3.10.0 does not fold primitive unions. It does. The claim I made on #8038, and repeated here, does not hold. What went wrong on my side: my local test runs were reporting green while the test host was crashing partway through, exit code -1073741571, and the runner still prints So both readers fold, and the difference I reported between the 2.x and 3.x lines was an artefact of my broken local runs, not real behaviour. I pushed the fix here rather than just the bump. The narrowing rule follows your guidance on #8038: a numeric type paired with a string and a numeric format resolves to the numeric type, correlating the format first, and a string only wins when there is no numeric format to go on. Rather than invent a precedence I reused the rule
|
A component schema with no explicit discriminator mapping maps to itself, so resolving that mapping from CreateComposedModelDeclaration re-entered the method for the same schema and recursed until the stack overflowed. AddDiscriminatorMethodIfNeeded already guards the same cycle, the composed path did not. Reproduces on 3.10.0 with TypeScriptLanguageRefinerTests.ParsesAndRefines UnionOfPrimitiveValuesAsync, which crashed the test host rather than failing, so the runner still reported the tests it had finished as passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VUifZksSV3pi2zWxvs29ka
|
CI caught a second problem, and it is not caused by the plugin fix. Pushed
Bisected locally on the main worktree:
Reduced to a single deterministic repro: Cause: when a composed schema carries no explicit discriminator mapping, Fix: reuse the same visited set guard in the composed path. No new mechanism, and no new test, since the crashing test is already in the suite and is the regression check. Worth flagging about the failure mode: the runner printed Local verification on For the record, #8038 is unaffected. It pins 2.12.0 and its run settled at 289 of 289 green. |
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thank you for making the changes!
Why
Follow up to the discussion on #8038.
Microsoft.OpenApi3.10.0 has been out for a while and we are still on 3.9.0, and I wanted to establish exactly what the upgrade costs before the 1.29 security branch made any assumptions about it.What
Two lines.
Microsoft.OpenApiandMicrosoft.OpenApi.YamlReader3.9.0 to 3.10.0.IOpenApiSchema.Examplein favour ofExamples, and we treat that warning as an error. The only usage is the schema copy inPluginsGenerationService, so it copiesExamplesnow.That is the entire upgrade. Full suite is green,
dotnet format --verify-no-changesis clean.On the anyOf concern
The worry raised in #8038 was that the newer readers fold
anyOf: [string, integer]into a single flags-enumTypeand null outAnyOf, which would stopSelectFirstAnyOneOfVisitorfrom ever firing. SinceJsonSchemaTypeis a flags enum, the authoring order is not recoverable once that happens.That does not affect the 3.x line.
GeneratesManifestAndCleansUpInputDescriptionAsyncassertsAnyOf.Count == 2on the freshly loaded source document, and it still passes on 3.10.0.It is real on the 2.x line: pinning the 1.29 branch to 2.12.0 makes that same assertion throw a
NullReferenceExceptionbecauseAnyOfis null, against a byte identical fixture. So it is a 2.12.0 specific behaviour, not something inherited by 3.10.0.For the 1.29 branch that means 2.11.0 is the right target rather than 2.12.0, which is what #8038 now does. No behavioural decision is needed in either place.