[repo-assist] test+refactor: V3 allOf composite/nullable/additionalProperties tests; hoist isEmpty checks (+5 tests, 443→448)#446
Conversation
…; hoist isEmpty checks in DefinitionCompiler (+5 tests, 443→448) - Add allOf composite tests: multiple inline schemas merge all properties - Add nullable required property → option type test - Add additionalProperties → Map<string, T> tests (no named type emitted; property has generic Map type) - Refactor DefinitionCompiler.compileNewObject: hoist propertiesEmpty + allOfEmpty before if/elif/else to avoid evaluating Seq.isEmpty allOf twice Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@copilot fix the build |
There was a problem hiding this comment.
Pull request overview
Adds targeted regression tests around OpenAPI v3 schema compilation edge-cases (multi-inline allOf, required+nullable properties, and additionalProperties map shapes) and slightly refactors DefinitionCompiler.compileNewObject to avoid repeating Seq.isEmpty checks.
Changes:
- Added 5 new v3 schema compilation tests covering multi-inline
allOf, required+nullable →option, andadditionalProperties→Map<_,_>behaviors. - Refactored
compileNewObjectto hoistSeq.isEmptychecks forproperties/allOfinto locals.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/SwaggerProvider.Tests/Schema.V3SchemaCompilationTests.fs | Adds new tests for previously uncovered v3 compilation paths (allOf, nullable+required, additionalProperties). |
| src/SwaggerProvider.DesignTime/DefinitionCompiler.fs | Hoists Seq.isEmpty results to avoid repeated emptiness checks when compiling object schemas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/fsprojects/SwaggerProvider/sessions/3bf5f3ba-9a8c-4fbb-b9f0-a4e2dff6d971 Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@copilot fix the build |
… option Agent-Logs-Url: https://github.com/fsprojects/SwaggerProvider/sessions/46d3dd73-5dd7-409a-8cae-79c5deef8acf Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
Fixed in a53ac96. The test |
|
@copilot fix build |
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Tests (Task 9 — Testing Improvements)
Five new tests for
Schema.V3SchemaCompilationTests.fscovering three previously untested V3 schema compilation paths:allOf with multiple inline schemas (2 tests)
allOfcontaining two inlineobjectschemas merges all their properties into the compiled type.NameandBreedproperties both appear onDogand have the expectedstring optiontype.nullable required property →
optiontype (1 test)requiredandnullable: truemust compile tostring option, notstring, because null is a valid value at runtime.isSchemaNullablepath incompileBySchema.additionalProperties →
Map<string, T>(2 tests)additionalProperties(no explicitproperties) releases its name reservation and compiles toMap<string, string>.StringMaptype is emitted, and that aWrapper.Dataproperty referencing it receives a genericMap<...>type.Coding improvement (Task 5/4 fallback — Coding Improvements)
DefinitionCompiler.compileNewObject: previouslySeq.isEmpty allOfwas evaluated twice — once in theifguard and again inside theelsebranch aslet allOfEmpty = Seq.isEmpty allOf. Hoisted bothpropertiesEmptyandallOfEmptybefore theif/elif/elseso each sequence is evaluated at most once.Test Status
Closes no issue — proactive quality improvement.