Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sprint7] [91] Replace manually created documentation with Spring Rest Docs #128

Merged
7 commits merged into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@ install:
- mvn test-compile -DskipTests=true -Dmaven.javadoc.skip=true -B -V

after_success:
- mvn clean test cobertura:cobertura jacoco:report coveralls:report
- mvn clean test cobertura:cobertura jacoco:report coveralls:report

# Deploy Github pages after success of Java Tests.
deploy:
provider: pages
skip_cleanup: true
keep-history: false
target-branch: gh-pages
github_token: "$GITHUB_TOKEN"
local_dir: "./target/generated-docs"
on:
branch: master
122 changes: 2 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,125 +15,7 @@ $ mvn clean spring-boot:run
$ mvn clean package -DskipTests -Dproduction
```

## Rest API
## Developer Documentation

| **Title** | **Products** |
| :------------------- | :------------------------------------------------------------------------------------------ |
| **Description** | Returns a list of all products. |
| **URL** | ```/products``` |
| **Method** | **GET** |
| **URL Parameters** | |
| **Success Response** | **Code:** 200 OK<br/>**Content Type:** application/json<br/> |
| **Sample Request** | ```/products``` |
| **Notes** | These are managed products for this service and not products from a remote product manager. |
- [API Documentation](https://tamulib.github.io/ProjectManagementService)

```json
{
"meta": {
"status": ApiStatus,
"action": ApiAction,
"message": String,
"id": String
},
"payload": {
"ArrayList<Product>": [
{
"id": Long,
"name": String,
"scopeId": String,
"remoteProductManager": {
"id": Long,
"name": String,
"type": String
}
}
]
}
}
```

<hr />

| **Title** | **Active Sprints** |
| :------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Description** | Returns a list of all active sprints based on associated remote product manager products. |
| **URL** | ```/sprints/active``` |
| **Method** | **GET** |
| **URL Parameters** | |
| **Success Response** | **Code:** 200 OK<br/>**Content Type:** application/json<br/>**Schema:** |
| **Sample Request** | ```/sprints/active``` |
| **Notes** | Currently, VersionOne is the only remote product manager implemented. VersionOne sprints are based on a timebox which is a sprint schedule in the UI. Products can share the same sprint schedule and will appear to be the same sprint in this response. |

```json
{
"meta": {
"status": ApiStatus,
"action": ApiAction,
"message": String,
"id": String
},
"payload": {
"ArrayList<Sprint>": [
{
"id": String,
"name": String,
"product": String,
"cards": [
{
"id": String,
"number": String,
"type": String,
"status": String,
"name": String,
"description": String,
"estimate": Float,
"assignees": [
{
"id": String,
"name": String,
"avatar": String
}
]
}
]
}
]
}
}
```

<hr />

| **Title** | **Products Stats** |
| :------------------- | :------------------------------------------------------------------------------------------------------------------ |
| **Description** | Returns a list of all products with statistics gathered from their associated remote product manager products. |
| **URL** | ```/products/stats``` |
| **Method** | **GET** |
| **URL Parameters** | |
| **Success Response** | **Code:** 200 OK<br/>**Content Type:** application/json |
| **Sample Request** | ```/products/stats``` |
| **Notes** | |

```json
{
"meta": {
"status": ApiStatus,
"action": ApiAction,
"message": String,
"id": String
},
"payload": {
"ArrayList<ProductStats>": [
{
"id": String,
"name": String,
"requestCount": Interger,
"issueCount": Interger,
"featureCount": Interger,
"defectCount": Interger,
"backlogItemCount": Interger
}
]
}
}
```
64 changes: 64 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,29 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-solr</artifactId>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
Expand Down Expand Up @@ -197,6 +214,53 @@
<repoToken></repoToken>
</configuration>
</plugin>

<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.7.1</version>
<executions>
<execution>
<id>generate-docs</id>
<phase>test</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>html5</backend>
<doctype>book</doctype>
<attributes>
<snippets>${project.build.directory}/generated-snippets</snippets>
<project-version>${project.version}</project-version>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-docs-git</id>
<phase>test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.outputDirectory}/static/docs
</outputDirectory>
<resources>
<resource>
<directory>
${project.build.directory}/generated-docs
</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
28 changes: 28 additions & 0 deletions src/main/asciidoc/activeSprintsAPI.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
== Active Sprints API
A Collection of API endpoints used for interacting with Product Management Service's Active Sprints resource.

=== Get Active Sprints

A `GET` to the `/sprints/active` endpoint which will return a list all Active Sprints in Product Management Service.

==== Sample Request
include::../../../target/generated-snippets/sprints/active/http-request.adoc[]

==== Sample Response
include::../../../target/generated-snippets/sprints/active/http-response.adoc[]

==== Example Curl Request
include::../../../target/generated-snippets/sprints/active/curl-request.adoc[]

=== Update Active Sprints Cache

A `GET` to the `/sprints/active/update` endpoint which will cause the Active Sprints cache in Product Management Service to be rebuilt.

==== Sample Request
include::../../../target/generated-snippets/sprints/active/update/http-request.adoc[]

==== Sample Response
include::../../../target/generated-snippets/sprints/active/update/http-response.adoc[]

==== Example Curl Request
include::../../../target/generated-snippets/sprints/active/update/curl-request.adoc[]
25 changes: 25 additions & 0 deletions src/main/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

= Product Management APIs
{project-version}
:doctype: book
:toc: left
:toclevels: 2
:sectanchors:
:sectlinks:
:linkattrs:
:source-highlighter: highlightjs

include::./activeSprintsAPI.adoc[]

include::./productsStatsAPI.adoc[]

include::./remoteProjectsStatsAPI.adoc[]

include::./internalRequestAPI.adoc[]

include::./productsAPI.adoc[]

include::./remoteProjectManagerAPI.adoc[]

include::./statusAPI.adoc[]

67 changes: 67 additions & 0 deletions src/main/asciidoc/internalRequestAPI.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
== Internal Request API
A Collection of CRUD API endpoints used for interacting with Product Management Service's Internal Request resource.

=== Get All Internal Requests

A `GET` to the `/internal/request` endpoint which will return a list all Internal Request in Product Management Service.

==== Sample Request
include::../../../target/generated-snippets/internal/request/get-all/http-request.adoc[]

==== Sample Response
include::../../../target/generated-snippets/internal/request/get-all/http-response.adoc[]

==== Example Curl Request
include::../../../target/generated-snippets/internal/request/get-all/curl-request.adoc[]

=== Get Internal Request

A `GET` to the `/internal/request/{id}` endpoint which will return a single Internal Request with the given ID in Product Management Service.

==== Sample Request
include::../../../target/generated-snippets/internal/request/get/http-request.adoc[]

==== Sample Response
include::../../../target/generated-snippets/internal/request/get/http-response.adoc[]

==== Example Curl Request
include::../../../target/generated-snippets/internal/request/get/curl-request.adoc[]

=== Create Internal Request

A `POST` to the `/internal/request` endpoint which will result in the creation of a new Internal Request in Product Management Service.

==== Sample Request
include::../../../target/generated-snippets/internal/request/create/http-request.adoc[]

==== Sample Response
include::../../../target/generated-snippets/internal/request/create/http-response.adoc[]

==== Example Curl Request
include::../../../target/generated-snippets/internal/request/create/curl-request.adoc[]

=== Update Internal Request

A `PUT` request to the `/internal/request` endpoint which will result in the updating of the specified Internal Request resource in Product Management Service.

==== Sample Request
include::../../../target/generated-snippets/internal/request/update/http-request.adoc[]

==== Sample Response
include::../../../target/generated-snippets/internal/request/update/http-response.adoc[]

==== Example Curl Request
include::../../../target/generated-snippets/internal/request/update/curl-request.adoc[]

=== Delete Internal Request

A `DELETE` request to the `/internal/request` endpoint which will result in the deletion of the specified Internal Request resource in Product Management Service.

==== Sample Request
include::../../../target/generated-snippets/internal/request/delete/http-request.adoc[]

==== Sample Response
include::../../../target/generated-snippets/internal/request/delete/http-response.adoc[]

==== Example Curl Request
include::../../../target/generated-snippets/internal/request/delete/curl-request.adoc[]