Skip to content
Snippets Groups Projects
Verified Commit 95c9fa29 authored by Mirio Eggmann's avatar Mirio Eggmann :zap:
Browse files

add openapi specification json

parent 7b3e7a94
No related branches found
No related tags found
No related merge requests found
Pipeline #305912 failed
Example code for Interface Representation Patterns
## Overview
This minimal example shows ...
# Example code for Interface Representation Patterns
## Running The Application
To test the example application run the following commands.
* To start the server run:
```bash
./gradlew bootRun
```
* By default the server will listen to port 8080. To create a new claim run:
## Example Requests
By default the server will listen to port 8080. To create a new claim run:
```curl http://localhost:8080/claims -H "Content-Type: application/json" -d "{\"dateOfIncident\":\"2017-02-01\", \"amount\": 2000 }"```
```curl http://localhost:8080/claims -H "Content-Type: application/json" -d "{\"dateOfIncident\":\"2017-02-01\", \"amount\": 2000 }"```
```curl http://localhost:8080/claims```
```curl http://localhost:8080/claims```
or with pagination:
or with pagination:
```curl http://localhost:8080/claims\?limit\=10\&offset\=0```
```curl http://localhost:8080/claims\?limit\=10\&offset\=0```
You can also use the provided [Postman Collection](riskmanagement-server.postman_collection.json) to test the application or checkout the [OpenAPI definition](openapi.json).
* You can also use the provided Postman Collection `riskmanagement-server.postman_collection.json` to test the application and checkout the OpenAPI documentation at http://localhost:8080/swagger-ui.html
When running the app you can also open the SwaggerUI under: http://localhost:8080/swagger-ui.html
{
"openapi": "3.0.1",
"info": {
"title": "OpenAPI definition",
"version": "v0"
},
"servers": [
{
"url": "http://localhost:8080",
"description": "Generated server url"
}
],
"paths": {
"/claims/{claimId}": {
"get": {
"tags": [
"claim-management"
],
"operationId": "getClaimById",
"parameters": [
{
"name": "claimId",
"in": "query",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ClaimDTO"
}
}
}
}
}
},
"put": {
"tags": [
"claim-management"
],
"operationId": "updateClaim",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"claimId": {
"type": "string",
"format": "uuid"
},
"claim": {
"$ref": "#/components/schemas/Claim"
}
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ClaimDTO"
}
}
}
}
}
}
},
"/claims": {
"get": {
"tags": [
"claim-management"
],
"operationId": "listClaims",
"parameters": [
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 3
}
},
{
"name": "offset",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"format": "int32",
"default": 3
}
},
{
"name": "orderBy",
"in": "query",
"required": false,
"schema": {
"type": "string",
"default": ""
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ClaimsDTO"
}
}
}
}
}
},
"post": {
"tags": [
"claim-management"
],
"operationId": "openClaim",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OpenClaimParameters"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ClaimDTO"
}
}
}
}
}
}
},
"/claims/{claimId}/evidence": {
"post": {
"tags": [
"claim-management"
],
"operationId": "addEvidenceToClaim",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"claimId": {
"type": "string",
"format": "uuid"
},
"params": {
"$ref": "#/components/schemas/AddEvidenceParameters"
}
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ClaimDTO"
}
}
}
}
}
}
},
"/riskreport": {
"get": {
"tags": [
"risk-report"
],
"operationId": "getRiskReport",
"parameters": [
{
"name": "firstYear",
"in": "query",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "noOfYears",
"in": "query",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RiskAssessment"
}
}
}
}
}
}
}
},
"/claims/{claimId}/evidence/{evidenceId}": {
"delete": {
"tags": [
"claim-management"
],
"operationId": "deleteEvidenceFromClaim",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"claimId": {
"type": "string",
"format": "uuid"
},
"evidenceId": {
"type": "string",
"format": "uuid"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/ClaimDTO"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Claim": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"dateOfIncident": {
"type": "string",
"format": "date"
},
"amount": {
"type": "number",
"format": "double"
},
"evidence": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Evidence"
}
}
}
},
"Evidence": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"description": {
"type": "string"
}
}
},
"ClaimDTO": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"dateOfIncident": {
"type": "string"
},
"amount": {
"type": "number",
"format": "double"
},
"evidence": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Evidence"
}
}
}
},
"OpenClaimParameters": {
"type": "object",
"properties": {
"dateOfIncident": {
"type": "string"
},
"amount": {
"type": "number",
"format": "double"
}
}
},
"AddEvidenceParameters": {
"type": "object",
"properties": {
"evidence": {
"type": "string"
}
}
},
"RiskAssessment": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"format": "int32"
},
"policyCount": {
"type": "integer",
"format": "int32"
},
"totalClaimValue": {
"type": "number",
"format": "double"
},
"claimCount": {
"type": "integer",
"format": "int32"
},
"totalInsuredValue": {
"type": "number",
"format": "double"
}
}
},
"ClaimsDTO": {
"type": "object",
"properties": {
"limit": {
"type": "integer",
"format": "int32"
},
"offset": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
},
"orderBy": {
"type": "string"
},
"claims": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ClaimDTO"
}
}
}
}
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment