diff --git a/Examples/nesting/nesting.yaml b/Examples/nesting/nesting.yaml index 17d46ed94..c25137c09 100644 --- a/Examples/nesting/nesting.yaml +++ b/Examples/nesting/nesting.yaml @@ -44,6 +44,7 @@ components: type: string actual: type: string + type: object AlmostModel: type: object allOf: @@ -55,6 +56,7 @@ components: type: string almost: type: string + type: object BaseModel: properties: base: diff --git a/Examples/polymorphism/polymorphism-3.1.0.yaml b/Examples/polymorphism/polymorphism-3.1.0.yaml index 07413a1aa..ae02915a2 100644 --- a/Examples/polymorphism/polymorphism-3.1.0.yaml +++ b/Examples/polymorphism/polymorphism-3.1.0.yaml @@ -56,6 +56,7 @@ components: type: type: string const: Virtual + type: object FlResponsible: type: object allOf: @@ -67,6 +68,7 @@ components: type: - string - 'null' + type: object Request: properties: payload: diff --git a/Examples/polymorphism/polymorphism.yaml b/Examples/polymorphism/polymorphism.yaml index 606f41383..01ccbe65a 100644 --- a/Examples/polymorphism/polymorphism.yaml +++ b/Examples/polymorphism/polymorphism.yaml @@ -59,6 +59,7 @@ components: type: string enum: - Virtual + type: object FlResponsible: type: object allOf: @@ -69,6 +70,7 @@ components: property3: type: string nullable: true + type: object Request: properties: payload: diff --git a/Examples/using-interfaces/using-interfaces.yaml b/Examples/using-interfaces/using-interfaces.yaml index 2ea4715f3..2d3cfcdde 100644 --- a/Examples/using-interfaces/using-interfaces.yaml +++ b/Examples/using-interfaces/using-interfaces.yaml @@ -65,6 +65,7 @@ components: color: description: 'The product color.' example: blue + type: object Product: title: 'Product model' type: object @@ -78,6 +79,7 @@ components: type: integer format: int64 example: 1 + type: object ProductInterface: properties: name: diff --git a/Examples/using-refs/using-refs.yaml b/Examples/using-refs/using-refs.yaml index 28a14067f..5481817ac 100644 --- a/Examples/using-refs/using-refs.yaml +++ b/Examples/using-refs/using-refs.yaml @@ -63,6 +63,7 @@ components: $ref: '#/components/schemas/product_status' stockLevel: $ref: '#/components/schemas/StockLevel' + type: object StockLevel: type: string enum: diff --git a/Examples/using-traits/using-traits.yaml b/Examples/using-traits/using-traits.yaml index b13f664d7..8227ac1a5 100644 --- a/Examples/using-traits/using-traits.yaml +++ b/Examples/using-traits/using-traits.yaml @@ -57,6 +57,7 @@ components: plating: description: 'The plating.' example: gold + type: object CustomName/Blink: title: 'Blink trait' properties: @@ -103,6 +104,7 @@ components: bell: description: 'The product bell.' example: gong + type: object SimpleProduct: title: 'SimpleProduct model' type: object @@ -116,6 +118,7 @@ components: type: integer format: int64 example: 1 + type: object TrickyProduct: title: 'TrickyProduct model' type: object @@ -129,3 +132,4 @@ components: trick: description: 'The trick.' example: 'recite poem' + type: object diff --git a/src/Processors/AugmentSchemas.php b/src/Processors/AugmentSchemas.php index 44298fc13..47952b0c6 100644 --- a/src/Processors/AugmentSchemas.php +++ b/src/Processors/AugmentSchemas.php @@ -132,6 +132,7 @@ protected function mergeAllOf(Analysis $analysis, array $schemas): void if (!$allOfPropertiesSchema) { $allOfPropertiesSchema = new OA\Schema([ 'properties' => [], + 'type' => 'object', '_context' => new Context(['generated' => true], $schema->_context), ]); $analysis->addAnnotation($allOfPropertiesSchema, $allOfPropertiesSchema->_context); diff --git a/tests/Fixtures/Apis/basic.yaml b/tests/Fixtures/Apis/basic.yaml index 8aec68530..ab059174b 100644 --- a/tests/Fixtures/Apis/basic.yaml +++ b/tests/Fixtures/Apis/basic.yaml @@ -137,6 +137,12 @@ components: properties: quantity: type: integer + id: + description: 'The id.' + format: int64 + example: 1 + releasedAt: + type: string brand: type: - string @@ -145,16 +151,11 @@ components: example: null colour: $ref: '#/components/schemas/Colour' - releasedAt: - type: string - id: - description: 'The id.' - format: int64 - example: 1 kind: description: 'The kind.' type: string const: Virtual + type: object securitySchemes: bearerAuth: type: http diff --git a/tests/Fixtures/Scratch/AttributeInheritance.yaml b/tests/Fixtures/Scratch/AttributeInheritance.yaml index 02904e3fe..84373420c 100644 --- a/tests/Fixtures/Scratch/AttributeInheritance.yaml +++ b/tests/Fixtures/Scratch/AttributeInheritance.yaml @@ -25,6 +25,7 @@ components: properties: name: type: string + type: object Child2: type: object allOf: @@ -34,3 +35,4 @@ components: properties: title: type: string + type: object diff --git a/tests/Fixtures/Scratch/Docblocks.yaml b/tests/Fixtures/Scratch/Docblocks.yaml index 418ec3e0c..9f3e6595c 100644 --- a/tests/Fixtures/Scratch/Docblocks.yaml +++ b/tests/Fixtures/Scratch/Docblocks.yaml @@ -26,3 +26,4 @@ components: id: description: 'The id' type: integer + type: object diff --git a/tests/Fixtures/Scratch/MergeTraitsExtended.yaml b/tests/Fixtures/Scratch/MergeTraitsExtended.yaml index 1bad5641e..0b97ac0ed 100644 --- a/tests/Fixtures/Scratch/MergeTraitsExtended.yaml +++ b/tests/Fixtures/Scratch/MergeTraitsExtended.yaml @@ -51,3 +51,4 @@ components: type: string name: type: string + type: object