|
| 1 | +Feature: Documentation support |
| 2 | + In order to build an auto-discoverable API |
| 3 | + As a client software developer |
| 4 | + I need to know OpenAPI specifications of objects I send and receive |
| 5 | + |
| 6 | + @createSchema |
| 7 | + Scenario: Retrieve the OpenAPI documentation |
| 8 | + Given I send a "GET" request to "/docs.json" |
| 9 | + Then the response status code should be 200 |
| 10 | + And the response should be in JSON |
| 11 | + And the header "Content-Type" should be equal to "application/json; charset=utf-8" |
| 12 | + # Context |
| 13 | + And the JSON node "openapi" should be equal to "3.0.2" |
| 14 | + # Root properties |
| 15 | + And the JSON node "info.title" should be equal to "My Dummy API" |
| 16 | + And the JSON node "info.description" should be equal to "This is a test API." |
| 17 | + # Supported classes |
| 18 | + And the OpenAPI class "AbstractDummy" exists |
| 19 | + And the OpenAPI class "CircularReference" exists |
| 20 | + And the OpenAPI class "CircularReference-circular" exists |
| 21 | + And the OpenAPI class "CompositeItem" exists |
| 22 | + And the OpenAPI class "CompositeLabel" exists |
| 23 | + And the OpenAPI class "ConcreteDummy" exists |
| 24 | + And the OpenAPI class "CustomIdentifierDummy" exists |
| 25 | + And the OpenAPI class "CustomNormalizedDummy-input" exists |
| 26 | + And the OpenAPI class "CustomNormalizedDummy-output" exists |
| 27 | + And the OpenAPI class "CustomWritableIdentifierDummy" exists |
| 28 | + And the OpenAPI class "Dummy" exists |
| 29 | + And the OpenAPI class "RelatedDummy" exists |
| 30 | + And the OpenAPI class "DummyTableInheritance" exists |
| 31 | + And the OpenAPI class "DummyTableInheritanceChild" exists |
| 32 | + And the OpenAPI class "OverriddenOperationDummy-overridden_operation_dummy_get" exists |
| 33 | + And the OpenAPI class "OverriddenOperationDummy-overridden_operation_dummy_put" exists |
| 34 | + And the OpenAPI class "OverriddenOperationDummy-overridden_operation_dummy_read" exists |
| 35 | + And the OpenAPI class "OverriddenOperationDummy-overridden_operation_dummy_write" exists |
| 36 | + And the OpenAPI class "RelatedDummy" exists |
| 37 | + And the OpenAPI class "NoCollectionDummy" exists |
| 38 | + And the OpenAPI class "RelatedToDummyFriend" exists |
| 39 | + And the OpenAPI class "RelatedToDummyFriend-fakemanytomany" exists |
| 40 | + And the OpenAPI class "DummyFriend" exists |
| 41 | + And the OpenAPI class "RelationEmbedder-barcelona" exists |
| 42 | + And the OpenAPI class "RelationEmbedder-chicago" exists |
| 43 | + And the OpenAPI class "User-user_user-read" exists |
| 44 | + And the OpenAPI class "User-user_user-write" exists |
| 45 | + And the OpenAPI class "UuidIdentifierDummy" exists |
| 46 | + And the OpenAPI class "ThirdLevel" exists |
| 47 | + And the OpenAPI class "ParentDummy" doesn't exist |
| 48 | + And the OpenAPI class "UnknownDummy" doesn't exist |
| 49 | + And the OpenAPI path "/relation_embedders/{id}/custom" exists |
| 50 | + And the OpenAPI path "/override/swagger" exists |
| 51 | + And the OpenAPI path "/api/custom-call/{id}" exists |
| 52 | + And the JSON node "paths./api/custom-call/{id}.get" should exist |
| 53 | + And the JSON node "paths./api/custom-call/{id}.put" should exist |
| 54 | + # Properties |
| 55 | + And "id" property exists for the OpenAPI class "Dummy" |
| 56 | + And "name" property is required for OpenAPI class "Dummy" |
| 57 | + # Filters |
| 58 | + And the JSON node "paths./dummies.get.parameters[0].name" should be equal to "dummyBoolean" |
| 59 | + And the JSON node "paths./dummies.get.parameters[0].in" should be equal to "query" |
| 60 | + And the JSON node "paths./dummies.get.parameters[0].required" should be false |
| 61 | + And the JSON node "paths./dummies.get.parameters[0].schema.type" should be equal to "boolean" |
| 62 | + |
| 63 | + # Subcollection - check filter on subResource |
| 64 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[0].name" should be equal to "id" |
| 65 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[0].in" should be equal to "path" |
| 66 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[0].required" should be true |
| 67 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[0].schema.type" should be equal to "string" |
| 68 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[1].name" should be equal to "name" |
| 69 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[1].in" should be equal to "query" |
| 70 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[1].required" should be false |
| 71 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[1].schema.type" should be equal to "string" |
| 72 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[2].name" should be equal to "description" |
| 73 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[2].in" should be equal to "query" |
| 74 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[2].required" should be false |
| 75 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters[2].schema.type" should be equal to "string" |
| 76 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters" should have 3 element |
| 77 | + |
| 78 | + # Subcollection - check schema |
| 79 | + And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.responses.200.content.application/ld+json.schema.items.$ref" should be equal to "#/components/schemas/RelatedToDummyFriend-fakemanytomany" |
| 80 | + |
| 81 | + # Deprecations |
| 82 | + And the JSON node "paths./dummies.get.deprecated" should not exist |
| 83 | + And the JSON node "paths./deprecated_resources.get.deprecated" should be true |
| 84 | + And the JSON node "paths./deprecated_resources.post.deprecated" should be true |
| 85 | + And the JSON node "paths./deprecated_resources/{id}.get.deprecated" should be true |
| 86 | + And the JSON node "paths./deprecated_resources/{id}.delete.deprecated" should be true |
| 87 | + And the JSON node "paths./deprecated_resources/{id}.put.deprecated" should be true |
| 88 | + And the JSON node "paths./deprecated_resources/{id}.patch.deprecated" should be true |
| 89 | + |
| 90 | + Scenario: OpenAPI UI is enabled for docs endpoint |
| 91 | + Given I add "Accept" header equal to "text/html" |
| 92 | + And I send a "GET" request to "/docs" |
| 93 | + Then the response status code should be 200 |
| 94 | + And I should see text matching "My Dummy API" |
| 95 | + And I should see text matching "openapi" |
| 96 | + And I should see text matching "3.0.2" |
| 97 | + |
| 98 | + Scenario: OpenAPI UI is enabled for an arbitrary endpoint |
| 99 | + Given I add "Accept" header equal to "text/html" |
| 100 | + And I send a "GET" request to "/dummies" |
| 101 | + Then the response status code should be 200 |
| 102 | + And I should see text matching "openapi" |
| 103 | + And I should see text matching "3.0.2" |
0 commit comments