Skip to content

Commit 43124e0

Browse files
committed
Enhance composite schema tests to validate specific structures for anyOf cases
1 parent dbd1b68 commit 43124e0

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

test/unit/convertV2WithTypes.test.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,26 @@ describe('convertV2WithTypes', function() {
653653

654654
expect(parsedRequestBody).to.have.property('anyOf');
655655
expect(parsedRequestBody.anyOf).to.be.an('array').with.length(3);
656-
// Note: $ref schemas are resolved to empty objects, but composite structure is preserved
657-
expect(parsedRequestBody.anyOf[2]).to.have.property('type', 'object');
658-
expect(parsedRequestBody.anyOf[2].properties).to.have.property('guest');
656+
expect(parsedRequestBody.anyOf[0]).to.deep.equal({
657+
type: 'object',
658+
properties: {
659+
id: { type: 'integer' },
660+
name: { type: 'string' }
661+
}
662+
});
663+
expect(parsedRequestBody.anyOf[1]).to.deep.equal({
664+
type: 'object',
665+
properties: {
666+
role: { type: 'string' },
667+
permissions: { type: 'array', items: { type: 'string' } }
668+
}
669+
});
670+
expect(parsedRequestBody.anyOf[2]).to.deep.equal({
671+
type: 'object',
672+
properties: {
673+
guest: { type: 'boolean' }
674+
}
675+
});
659676

660677
// Check response body has allOf structure
661678
const responseBody = conversionResult.extractedTypes['post/test'].response['200'].body;

0 commit comments

Comments
 (0)