Skip to content

Commit f4f952a

Browse files
API-8013 - Removing RAML from this repo (#523)
* API-8013 - WIP - Removing RAML * API-8013 - Removing unused RAML related code * API-8013 - Removing commented code * API-8013 - PR Bot fixes * API-8013 - Tidy up bits and review comments * API-8013 - Rename method for clarity * API-8013 - Remove cacheBuster --------- Co-authored-by: Andy Spaven <16537059+AndySpaven@users.noreply.github.com>
1 parent bda92c3 commit f4f952a

File tree

79 files changed

+74
-3033
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+74
-3033
lines changed

acceptance/test/uk/gov/hmrc/apidocumentation/DescriptiveMocks.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ trait DescriptiveMocks extends Stubs {
3131
condition(s"$serviceName is deployed with version $version")
3232
developerIsSignedIn()
3333
fetchDefinition(serviceName)
34-
fetchApiSpec(serviceName, version)
3534
}
3635

3736
def apiDocumentationTestServiceIsDeployed(serviceName: String, version: String): Unit = {
3837
condition(s"$serviceName is deployed with version $version")
3938
developerIsSignedIn()
4039
fetchDefinition(serviceName)
41-
fetchApiSpec(serviceName, version)
4240
}
4341

4442
def apiDocumentationTestServiceVersionsIsDeployed(): Unit = {

acceptance/test/uk/gov/hmrc/apidocumentation/Stubs.scala

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ import scala.io.Source
2020

2121
import com.github.tomakehurst.wiremock.client.WireMock._
2222

23-
import play.api.libs.json.Json
2423
import play.utils.UriEncoding
2524

26-
import uk.gov.hmrc.apidocumentation.models.apispecification.ApiSpecification
27-
2825
trait Stubs extends ApiMicroservice with DeveloperFrontend with ApiPlatformMicroservice with XmlServices
2926

3027
trait XmlServices {
@@ -66,29 +63,6 @@ trait ApiPlatformMicroservice {
6663
.withBody(definitionJson))
6764
)
6865
}
69-
70-
def fetchApiSpec(serviceName: String, version: String): Unit = {
71-
val url = getClass.getResource(s"/services/$serviceName/spec_${version}.json")
72-
val file = Source.fromURL(url).mkString
73-
import uk.gov.hmrc.apidocumentation.models.apispecification.ApiSpecificationFormatters._
74-
Json.fromJson[ApiSpecification](Json.parse(file))
75-
76-
stubFor(get(urlPathEqualTo(s"/combined-api-definitions/$serviceName/$version/specification"))
77-
.willReturn(
78-
aResponse()
79-
.withStatus(200)
80-
.withHeader("Content-Type", "application/json")
81-
.withBody(file)
82-
))
83-
}
84-
85-
def failToFetch(serviceName: String): Unit = {
86-
stubFor(
87-
get(urlPathEqualTo(s"/combined-api-definitions/$serviceName/definition"))
88-
.willReturn(aResponse()
89-
.withStatus(404))
90-
)
91-
}
9266
}
9367

9468
trait ApiMicroservice {

acceptance/test/uk/gov/hmrc/apidocumentation/pages/ApiDocumentationTestServicePage.scala

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ object ApiDocumentationTestServicePage extends WebPage with TableDrivenPropertyC
3131

3232
val pageHeading = "Developer Forum API"
3333

34-
private val locationFieldOptional = By.className("parameter-optional")
35-
private val createUser = By.className("govuk-details__summary")
34+
private val createUser = By.className("govuk-details__summary")
3635

3736
def selectCreateUser(): Unit = {
3837
click(createUser)
@@ -69,14 +68,4 @@ object ApiDocumentationTestServicePage extends WebPage with TableDrivenPropertyC
6968
}
7069
}
7170

72-
def checkLocationFieldIsOptional(): Unit = {
73-
getText(locationFieldOptional) should include("optional")
74-
}
75-
76-
def checkAPIVersionInRequestHeader(): Unit = {
77-
click(By.id("users_post_post_details"))
78-
getText(By.id("application/vnd.hmrc.1.1+json")) should include("application/vnd.hmrc.1.1+json")
79-
80-
}
81-
8271
}

acceptance/test/uk/gov/hmrc/apidocumentation/pages/HelloWorldPage.scala

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -51,50 +51,6 @@ object HelloWorldPage extends WebPage with HasApplicationName with TableDrivenPr
5151
waitForPageToStopMoving()
5252
}
5353

54-
def assertEndpointsDetails(): Unit = {
55-
val ids =
56-
Table(
57-
("ID", "id"),
58-
("_say-hello-world_get_details", "_say-hello-world_get_content"),
59-
("_say-hello-user_get_details", "_say-hello-user_get_content"),
60-
("_say-hello-application_get_details", "_say-hello-application_get_content")
61-
)
62-
forAll(ids) { (ID: String, id: String) =>
63-
click(By.id(ID))
64-
isDisplayed(By.id(id)) shouldBe true
65-
}
66-
}
67-
68-
def assertAPIEndpoints(): Unit = {
69-
val endpoints =
70-
Table(
71-
("ID", "Endpoint Title", "Endpoint Request Type", "Endpoint URI"),
72-
("_say-hello-world_get_details", "Say hello world", "GET", "/hello/world"),
73-
("_say-hello-user_get_details", "Say hello user", "GET", "/hello/user"),
74-
("_say-hello-application_get_details", "Say hello application", "GET", "/hello/application")
75-
)
76-
77-
forAll(endpoints) { (id: String, endpointTitle: String, endpointRequestType: String, endpointUri: String) =>
78-
getText(By.id(id)) should endWith(endpointRequestType)
79-
getText(By.id(endpointUri)) shouldBe endpointUri
80-
}
81-
}
82-
83-
def assertOptionsEndpointsNotPresent() = {
84-
val endpoints =
85-
Table(
86-
"ID",
87-
"#_say-hello-world-supported-http-methods",
88-
"#_say-hello-user-supported-http-methods",
89-
"#_say-hello-application-supported-http-methods"
90-
)
91-
92-
forAll(endpoints) { (id: String) =>
93-
findElement(By.cssSelector(s"${id}_options_accordion .accordion__button")) shouldBe None
94-
findElement(By.cssSelector(s"${id}_options_accordion .http-verb.http-verb--options.float--right")) shouldBe None
95-
}
96-
}
97-
9854
def assertMenuLinkColors(): Unit = {
9955
val menuLink =
10056
Table(
@@ -122,23 +78,25 @@ object HelloWorldPage extends WebPage with HasApplicationName with TableDrivenPr
12278
Table(
12379
("Navigation links", "Number"),
12480
("Overview", "1"),
125-
("Versioning", "2"),
126-
("Errors", "3"),
127-
("Endpoints", "4")
81+
("Errors", "2"),
82+
("Testing", "3"),
83+
("Versioning", "4"),
84+
("Endpoints", "5")
12885
)
12986
forAll(navigationItems) { (navigationLink: String, number: String) =>
13087
val expectedCSSSelector = By.cssSelector("nav.side-nav > ul > li:nth-of-type(" + number + ") > a")
13188
getText(expectedCSSSelector) shouldBe navigationLink
13289
}
13390
}
13491

135-
def waitUntilLinksGetToTheTopOfThePage(): Unit = {
92+
def testClickAllNavLinks(): Unit = {
13693
val navigationItems =
13794
Table(
13895
"Navigation links",
13996
"Overview",
140-
"Versioning",
14197
"Errors",
98+
"Testing",
99+
"Versioning",
142100
"Endpoints"
143101
)
144102
forAll(navigationItems) { (navigationLink: String) =>
@@ -149,18 +107,10 @@ object HelloWorldPage extends WebPage with HasApplicationName with TableDrivenPr
149107

150108
waitForPageToStopMoving()
151109
position = executeScript(s"return document.getElementById('$id').getBoundingClientRect().top;")(Driver.instance).toString.toDouble.toInt
152-
// assert(position == 0)
153110
}
154111
}
155112

156113
def waitForPageToStopMoving() = {
157114
new WebDriverWait(Driver.instance, Duration.ofSeconds(5)).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("""main:not([style*="margin-top"])""")))
158115
}
159-
160-
def checkBackToTopLinkAfterErrorsSection(): Unit = {
161-
isDisplayed(errorsBackToTop) shouldBe true
162-
getText(errorsBackToTop) shouldBe "Skip to main content"
163-
isDisplayed(endpointsBackToTop) shouldBe true
164-
getText(endpointsBackToTop) shouldBe "Skip to main content"
165-
}
166116
}

acceptance/test/uk/gov/hmrc/apidocumentation/specs/DocumentationSpec.scala

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ class DocumentationSpec extends BaseSpec with ComponentTestsSpec with TableDrive
3434
Given.helloWorldIsDeployed("api-example-microservice", "1.0")
3535
APIDocumentationPage.selectHelloWorld()
3636
on(HelloWorldPage)
37-
38-
Then("I see the following API endpoints for the default version of my selected API")
39-
HelloWorldPage.assertAPIEndpoints()
4037
}
4138

4239
Scenario("OPTIONS endpoints are not displayed for the selected API") {
@@ -48,9 +45,6 @@ class DocumentationSpec extends BaseSpec with ComponentTestsSpec with TableDrive
4845
Given.helloWorldIsDeployed("api-example-microservice", "1.0")
4946
APIDocumentationPage.selectHelloWorld()
5047
on(HelloWorldPage)
51-
52-
Then("I do not see the OPTIONS API endpoints for the selected API")
53-
HelloWorldPage.assertOptionsEndpointsNotPresent()
5448
}
5549

5650
Scenario("Breadcrumb for the API endpoint") {
@@ -79,9 +73,6 @@ class DocumentationSpec extends BaseSpec with ComponentTestsSpec with TableDrive
7973
Given.helloWorldIsDeployed("api-example-microservice", "1.0")
8074
APIDocumentationPage.selectHelloWorld()
8175
on(HelloWorldPage)
82-
83-
Then("I can see the details of the following end points when a HTTP verb button is clicked on")
84-
HelloWorldPage.assertEndpointsDetails()
8576
}
8677

8778
Scenario("Ensure the same version that is displayed on the API index page is also displayed by default when API Documentation Test Service is selected") {
@@ -124,10 +115,6 @@ class DocumentationSpec extends BaseSpec with ComponentTestsSpec with TableDrive
124115

125116
And("I select version v1.5 (Beta)")
126117
CommonPage.selectVersion("v1.5 (Beta)")
127-
128-
Then("location field is optional")
129-
ApiDocumentationTestServicePage.selectCreateUser()
130-
ApiDocumentationTestServicePage.checkLocationFieldIsOptional()
131118
}
132119

133120
Scenario("Ensure user can access the Hello World API Summary Details page and view all endpoints for a Beta version") {
@@ -142,9 +129,6 @@ class DocumentationSpec extends BaseSpec with ComponentTestsSpec with TableDrive
142129

143130
And("I select version 'v1.2 (Beta)")
144131
CommonPage.selectVersion("v1.2 (Beta)")
145-
146-
Then("I can see the details of the following end points when a HTTP verb button is clicked on")
147-
HelloWorldPage.assertEndpointsDetails()
148132
}
149133

150134
Scenario("Update API Version in the request header") {
@@ -154,14 +138,11 @@ class DocumentationSpec extends BaseSpec with ComponentTestsSpec with TableDrive
154138
Given("I have navigated to the API documentation page")
155139
goOn(APIDocumentationPage)
156140

157-
When("I select to view the API Documentation Test documentation")
141+
When("I select to view the API Documentation Test documentation")
158142
APIDocumentationPage.selectAPIDocumentationTestService()
159143

160144
And("I select version 'v1.1 (Stable)")
161145
CommonPage.selectVersion("v1.1 (Stable)")
162-
163-
Then("API version in the request header matches the API version selected")
164-
ApiDocumentationTestServicePage.checkAPIVersionInRequestHeader()
165146
}
166147
}
167148
}

acceptance/test/uk/gov/hmrc/apidocumentation/specs/NavigationSpec.scala

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class NavigationSpec extends BaseSpec with ComponentTestsSpec with TableDrivenPr
9292
on(HelloWorldPage)
9393

9494
Then("user is navigated to the appropriate section on the page when clicked on the left Menu option")
95-
HelloWorldPage.waitUntilLinksGetToTheTopOfThePage()
95+
HelloWorldPage.testClickAllNavLinks()
9696
}
9797

9898
Scenario("Dev Hub Name") {
@@ -118,19 +118,5 @@ class NavigationSpec extends BaseSpec with ComponentTestsSpec with TableDrivenPr
118118
Then("the application name is HMRC Developer Hub")
119119
HelloWorldPage.applicationName() shouldBe expectedApplicationName
120120
}
121-
122-
Scenario("Ensure back to the top link only exists after Errors section") {
123-
Given("I have navigated to the API documentation page")
124-
Given.apiServicesIsDeployed()
125-
goOn(APIDocumentationPage)
126-
127-
When("I select to view the Hello World documentation")
128-
Given.helloWorldIsDeployed("api-example-microservice", "1.0")
129-
APIDocumentationPage.selectHelloWorld()
130-
on(HelloWorldPage)
131-
132-
Then("back to the top link only appears after Errors section")
133-
HelloWorldPage.checkBackToTopLinkAfterErrorsSection()
134-
}
135121
}
136122
}

app/assets/css/api.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ section > h2 {
179179

180180
}
181181

182-
.raml {
183-
strong {
184-
font-weight: bold;
185-
}
186-
}
187-
188182
.govuk-warning-text {
189183
position: relative;
190184
margin-bottom: 20px;

app/uk/gov/hmrc/apidocumentation/config/ApplicationConfig.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ trait ApplicationConfig {
2828
def developerFrontendBaseUrl: String
2929
def thirdPartyDeveloperUrl: String
3030
def apiPlatformMicroserviceBaseUrl: String
31-
def ramlPreviewMicroserviceBaseUrl: String
3231

3332
def securedCookie: Boolean
34-
def ramlPreviewEnabled: Boolean
3533
def openApiPreviewEnabled: Boolean
3634

3735
def showProductionAvailability: Boolean
@@ -43,8 +41,6 @@ trait ApplicationConfig {
4341
def sandboxApiBaseUrl: String
4442
def sandboxWwwBaseUrl: String
4543

46-
def documentationRenderVersion: String
47-
4844
def nameOfPrincipalEnvironment: String
4945
def nameOfSubordinateEnvironment: String
5046
def principalBaseUrl: String
@@ -81,10 +77,8 @@ class ApplicationConfigImpl @Inject() (config: Configuration)
8177
* DO NOT REMOVE
8278
*/
8379
lazy val apiPlatformMicroserviceBaseUrl = baseUrl("api-platform-microservice")
84-
lazy val ramlPreviewMicroserviceBaseUrl = baseUrl("raml-preview-microservice")
8580

8681
val securedCookie = getBoolean("cookie.secure")
87-
val ramlPreviewEnabled = getBoolean("features.ramlPreview")
8882
val openApiPreviewEnabled = getBoolean("features.openApiPreview")
8983

9084
val showProductionAvailability = getBoolean("features.showProductionAvailability")
@@ -95,8 +89,6 @@ class ApplicationConfigImpl @Inject() (config: Configuration)
9589
val sandboxApiBaseUrl = platformBaseUrl("platform.sandbox.api")
9690
val sandboxWwwBaseUrl = platformBaseUrl("platform.sandbox.www")
9791

98-
val documentationRenderVersion = getString("features.documentationRenderVersion")
99-
10092
val nameOfPrincipalEnvironment = getString("features.nameOfPrincipalEnvironment")
10193
val nameOfSubordinateEnvironment = getString("features.nameOfSubordinateEnvironment")
10294
val principalBaseUrl = getString("features.principalBaseUrl")

app/uk/gov/hmrc/apidocumentation/connectors/ApiPlatformMicroserviceConnector.scala

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,20 @@ import javax.inject.{Inject, Singleton}
2020
import scala.concurrent.{ExecutionContext, Future}
2121

2222
import uk.gov.hmrc.apiplatform.modules.apis.domain.models._
23-
import uk.gov.hmrc.apiplatform.modules.common.domain.models.ApiVersionNbr
2423
import uk.gov.hmrc.http.HttpReads.Implicits._
2524
import uk.gov.hmrc.http.client.HttpClientV2
2625
import uk.gov.hmrc.http.{HeaderCarrier, StringContextOps}
2726

2827
import uk.gov.hmrc.apidocumentation.config.ApplicationConfig
2928
import uk.gov.hmrc.apidocumentation.connectors.ApiPlatformMicroserviceConnector.{definitionUrl, definitionsUrl, queryParams}
3029
import uk.gov.hmrc.apidocumentation.models.DeveloperIdentifier
31-
import uk.gov.hmrc.apidocumentation.models.apispecification.ApiSpecification
3230
import uk.gov.hmrc.apidocumentation.util.ApplicationLogger
3331

3432
@Singleton
3533
class ApiPlatformMicroserviceConnector @Inject() (val http: HttpClientV2, val appConfig: ApplicationConfig)(implicit val ec: ExecutionContext) extends ApplicationLogger {
3634

3735
private lazy val serviceBaseUrl = appConfig.apiPlatformMicroserviceBaseUrl
3836

39-
def fetchApiSpecification(serviceName: ServiceName, version: ApiVersionNbr)(implicit hc: HeaderCarrier): Future[Option[ApiSpecification]] = {
40-
import uk.gov.hmrc.apidocumentation.models.apispecification.ApiSpecificationFormatters._
41-
val url = url"$serviceBaseUrl/combined-api-definitions/$serviceName/$version/specification"
42-
http.get(url).execute[Option[ApiSpecification]]
43-
}
44-
4537
def fetchApiDefinitionsByCollaborator(developerId: Option[DeveloperIdentifier])(implicit hc: HeaderCarrier): Future[Seq[ApiDefinition]] = {
4638
logger.info(s"${getClass.getSimpleName} - fetchApiDefinitionsByCollaborator")
4739
val r = http.get(url"${definitionsUrl(serviceBaseUrl)}?${queryParams(developerId)}").execute[Seq[ApiDefinition]]

0 commit comments

Comments
 (0)