From 7f0b3926a01195ec75265229b12a4aadeccbb2c9 Mon Sep 17 00:00:00 2001 From: Norbert Hartl Date: Sat, 1 Aug 2026 16:35:05 +0200 Subject: [PATCH] Add real-world confirmation test for the allOf-merge fix Confirms zweidenker/JSONSchema's new allOf-object-merge behavior against the actual bundled petstoreExpanded example's Pet schema (allOf[$ref NewPet, {required:[id], properties:{id}}]) rather than only a hand-built schema: reading now correctly merges properties and required from both branches into a typed NeoJSONObject, instead of the previous raw-passthrough Dictionary. Co-Authored-By: Claude Sonnet 5 --- .../OAExampleDocumentsTests.class.st | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/OpenAPI-Core-Tests/OAExampleDocumentsTests.class.st b/source/OpenAPI-Core-Tests/OAExampleDocumentsTests.class.st index 9b18c5e..692a257 100644 --- a/source/OpenAPI-Core-Tests/OAExampleDocumentsTests.class.st +++ b/source/OpenAPI-Core-Tests/OAExampleDocumentsTests.class.st @@ -36,6 +36,24 @@ OAExampleDocumentsTests >> testPetstoreExpandedIsValid [ self assert: (OADocumentValidator isValidDocument: OAExampleDocuments petstoreExpanded) ] +{ #category : 'tests' } +OAExampleDocumentsTests >> testPetstoreExpandedPetSchemaMergesAllOfBranchesForReading [ + "Real-world confirmation: OAExampleDocuments petstoreExpanded's Pet schema is + allOf[$ref NewPet, {required:[id], properties:{id}}] - resolves to JSONSchemaAnyObject. + Reading a response body against it must merge properties/required from BOTH + branches (NewPet contributes name/tag, the inline branch contributes id), not just + pass the raw JSON dictionary through." + | api petSchema result | + api := OpenAPI fromString: OAExampleDocuments petstoreExpanded. + petSchema := api components schemas at: 'Pet'. + result := petSchema readString: '{"id":42,"name":"Rex","tag":"dog"}'. + self assert: result class equals: NeoJSONObject. + self assert: result id equals: 42. + self assert: result name equals: 'Rex'. + self assert: result tag equals: 'dog'. + self should: [ petSchema readString: '{"name":"Rex","tag":"dog"}' ] raise: JSONTypeError +] + { #category : 'tests' } OAExampleDocumentsTests >> testPetstoreIsValid [ self assert: (OADocumentValidator isValidDocument: OAExampleDocuments petstore)