diff --git a/features/openapi/docs.feature b/features/openapi/docs.feature index 1a5e61c1513..7e48039b47c 100644 --- a/features/openapi/docs.feature +++ b/features/openapi/docs.feature @@ -153,7 +153,7 @@ Feature: Documentation support And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters" should have 6 elements # Subcollection - check schema - And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.responses.200.content.application/ld+json.schema.properties.hydra:member.items.$ref" should be equal to "#/components/schemas/RelatedToDummyFriend.jsonld-fakemanytomany" + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.responses.200.content.application/ld+json.schema.properties.hydra:member.items.$ref" should be equal to "#/components/schemas/RelatedToDummyFriend.jsonld-fakemanytomany.output" # Deprecations And the JSON node "paths./dummies.get.deprecated" should be false @@ -165,8 +165,8 @@ Feature: Documentation support And the JSON node "paths./deprecated_resources/{id}.patch.deprecated" should be true # Formats - And the OpenAPI class "Dummy.jsonld" exists - And the "@id" property exists for the OpenAPI class "Dummy.jsonld" + And the OpenAPI class "Dummy.jsonld.output" exists + And the "@id" property exists for the OpenAPI class "Dummy.jsonld.output" And the JSON node "paths./dummies.get.responses.200.content.application/ld+json" should be equal to: """ { @@ -176,7 +176,7 @@ Feature: Documentation support "hydra:member": { "type": "array", "items": { - "$ref": "#/components/schemas/Dummy.jsonld" + "$ref": "#/components/schemas/Dummy.jsonld.output" } }, "hydra:totalItems": { diff --git a/tests/JsonSchema/Command/JsonSchemaGenerateCommandTest.php b/tests/JsonSchema/Command/JsonSchemaGenerateCommandTest.php index 3ef06851574..50c95ba77f8 100644 --- a/tests/JsonSchema/Command/JsonSchemaGenerateCommandTest.php +++ b/tests/JsonSchema/Command/JsonSchemaGenerateCommandTest.php @@ -103,24 +103,24 @@ public function testArraySchemaWithReference(): void $result = $this->tester->getDisplay(); $json = json_decode($result, associative: true); - $this->assertEquals($json['definitions']['BagOfTests.jsonld-write']['properties']['tests'], [ + $this->assertEquals($json['definitions']['BagOfTests.jsonld-write.input']['properties']['tests'], [ 'type' => 'string', 'foo' => 'bar', ]); - $this->assertEquals($json['definitions']['BagOfTests.jsonld-write']['properties']['nonResourceTests'], [ + $this->assertEquals($json['definitions']['BagOfTests.jsonld-write.input']['properties']['nonResourceTests'], [ 'type' => 'array', 'items' => [ - '$ref' => '#/definitions/NonResourceTestEntity.jsonld-write', + '$ref' => '#/definitions/NonResourceTestEntity.jsonld-write.input', ], ]); - $this->assertEquals($json['definitions']['BagOfTests.jsonld-write']['properties']['description'], [ + $this->assertEquals($json['definitions']['BagOfTests.jsonld-write.input']['properties']['description'], [ 'maxLength' => 255, ]); - $this->assertEquals($json['definitions']['BagOfTests.jsonld-write']['properties']['type'], [ - '$ref' => '#/definitions/TestEntity.jsonld-write', + $this->assertEquals($json['definitions']['BagOfTests.jsonld-write.input']['properties']['type'], [ + '$ref' => '#/definitions/TestEntity.jsonld-write.input', ]); } @@ -130,14 +130,14 @@ public function testArraySchemaWithMultipleUnionTypesJsonLd(): void $result = $this->tester->getDisplay(); $json = json_decode($result, associative: true); - $this->assertEquals($json['definitions']['Nest.jsonld']['properties']['owner']['anyOf'], [ - ['$ref' => '#/definitions/Wren.jsonld'], - ['$ref' => '#/definitions/Robin.jsonld'], + $this->assertEquals($json['definitions']['Nest.jsonld.output']['properties']['owner']['anyOf'], [ + ['$ref' => '#/definitions/Wren.jsonld.output'], + ['$ref' => '#/definitions/Robin.jsonld.output'], ['type' => 'null'], ]); - $this->assertArrayHasKey('Wren.jsonld', $json['definitions']); - $this->assertArrayHasKey('Robin.jsonld', $json['definitions']); + $this->assertArrayHasKey('Wren.jsonld.output', $json['definitions']); + $this->assertArrayHasKey('Robin.jsonld.output', $json['definitions']); } public function testArraySchemaWithMultipleUnionTypesJsonApi(): void @@ -183,7 +183,7 @@ public function testArraySchemaWithTypeFactory(): void $result = $this->tester->getDisplay(); $json = json_decode($result, associative: true); - $this->assertEquals($json['definitions']['Foo.jsonld']['properties']['expiration'], ['type' => 'string', 'format' => 'date']); + $this->assertEquals($json['definitions']['Foo.jsonld.output']['properties']['expiration'], ['type' => 'string', 'format' => 'date']); } /** @@ -195,7 +195,7 @@ public function testWritableNonResourceRef(): void $result = $this->tester->getDisplay(); $json = json_decode($result, associative: true); - $this->assertEquals($json['definitions']['SaveProduct.jsonld']['properties']['codes']['items']['$ref'], '#/definitions/ProductCode.jsonld'); + $this->assertEquals($json['definitions']['SaveProduct.jsonld.input']['properties']['codes']['items']['$ref'], '#/definitions/ProductCode.jsonld.input'); } /** @@ -207,8 +207,8 @@ public function testOpenApiResourceRefIsNotOverwritten(): void $result = $this->tester->getDisplay(); $json = json_decode($result, associative: true); - $this->assertEquals('#/definitions/DummyFriend', $json['definitions']['Issue6299.Issue6299OutputDto.jsonld']['properties']['itemDto']['$ref']); - $this->assertEquals('#/definitions/DummyDate', $json['definitions']['Issue6299.Issue6299OutputDto.jsonld']['properties']['collectionDto']['items']['$ref']); + $this->assertEquals('#/definitions/DummyFriend', $json['definitions']['Issue6299.Issue6299OutputDto.jsonld.output']['properties']['itemDto']['$ref']); + $this->assertEquals('#/definitions/DummyDate', $json['definitions']['Issue6299.Issue6299OutputDto.jsonld.output']['properties']['collectionDto']['items']['$ref']); } /** @@ -220,7 +220,7 @@ public function testSubSchemaJsonLd(): void $result = $this->tester->getDisplay(); $json = json_decode($result, associative: true); - $this->assertArrayHasKey('@id', $json['definitions']['ThirdLevel.jsonld-friends']['properties']); + $this->assertArrayHasKey('@id', $json['definitions']['ThirdLevel.jsonld-friends.output']['properties']); } public function testJsonApiIncludesSchema(): void