From c713435ecc2ddb97ca8abc375f81efceea40d8db Mon Sep 17 00:00:00 2001 From: Simon Redfern Date: Sat, 3 Oct 2015 16:53:54 +0200 Subject: [PATCH] Recource Doc: id ->operation_id , description -> summary, overview -> description (as per swagger) --- src/main/scala/code/lib/ObpAPI.scala | 2 +- src/main/scala/code/snippet/ApiExplorer.scala | 12 ++++++------ src/main/webapp/api-explorer.html | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/scala/code/lib/ObpAPI.scala b/src/main/scala/code/lib/ObpAPI.scala index 30391803..3459b682 100644 --- a/src/main/scala/code/lib/ObpAPI.scala +++ b/src/main/scala/code/lib/ObpAPI.scala @@ -655,7 +655,7 @@ object ObpJson { // Used to describe the OBP API calls for documentation and API discovery purposes - case class ResourceDocJson(id: String, + case class ResourceDocJson(operation_id: String, request_verb: String, request_url: String, summary: String, // Summary of call should be 120 characters max diff --git a/src/main/scala/code/snippet/ApiExplorer.scala b/src/main/scala/code/snippet/ApiExplorer.scala index 68d3883a..0f09ba91 100644 --- a/src/main/scala/code/snippet/ApiExplorer.scala +++ b/src/main/scala/code/snippet/ApiExplorer.scala @@ -56,7 +56,7 @@ class ApiExplorer extends Loggable { // The overview contains html. Just need to convert it to a NodeSeq so the template will render it as such val resources = for { r <- getResourceDocsJson.map(_.resource_docs).get - } yield ResourceDoc(id = r.id, verb = r.request_verb, url = r.request_url, summary = r.summary, description = stringToNodeSeq(r.description), request_body = r.request_body) + } yield ResourceDoc(id = r.operation_id, verb = r.request_verb, url = r.request_url, summary = r.summary, description = stringToNodeSeq(r.description), request_body = r.request_body) @@ -161,13 +161,13 @@ class ApiExplorer extends Loggable { // replace the node identified by the class "resource" with the following // This creates the list of resources in the DOM ".resource" #> resources.map { i => - ".resource_description *" #> i.summary & - ".resource_description [href]" #> s"#${i.id}" & - ".resource_description [name]" #> s"${i.id}" & + ".resource_summary *" #> i.summary & + ".resource_summary [href]" #> s"#${i.id}" & + ".resource_summary [name]" #> s"${i.id}" & // Replace attribute named overview_text with the value (whole div/span element is replaced leaving just the text) - "@overview_text" #> i.description & + "@description_text" #> i.description & // Give attributes named overview an id - "@overview [id]" #> s"overview_${i.id}" & + "@resource_description [id]" #> s"description_${i.id}" & ".resource_url_td [id]" #> s"resource_url_td_${i.id}" & // Probably don't need this now ".resource_verb_td [id]" #> s"resource_verb_td_${i.id}" & // Probably don't need this now ".url_caller [id]" #> s"url_caller_${i.id}" & diff --git a/src/main/webapp/api-explorer.html b/src/main/webapp/api-explorer.html index dea48615..a852a14e 100644 --- a/src/main/webapp/api-explorer.html +++ b/src/main/webapp/api-explorer.html @@ -18,8 +18,8 @@ - Description -
Overview
+ Summary +
Description