Skip to content

Commit

Permalink
Increment: Added basic OpenAPI documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
zoernert committed Aug 11, 2024
1 parent 50bfd59 commit 61718dc
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 7 deletions.
18 changes: 16 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tydids-ssi-consent-router",
"version": "1.0.3",
"version": "1.0.4",
"description": "tydids-ssi-consent-router is a lightweight, SSI-based consent management solution. It acts as a proxy between web forms and backend systems, ensuring compliance with GDPR data privacy regulations. The router stores consent data, including SSI IDs and payloads, in a NoSQL database for efficient retrieval and management.",
"scripts": {
"dev": "moleculer-runner --hot services/**/*.service.js",
Expand All @@ -12,7 +12,7 @@
"dc:logs": "docker-compose logs -f",
"dc:down": "docker-compose down",
"createPrivateKey": "./createPrivateKey.js",
"setup":"./setup.js"
"setup": "./setup.js"
},
"keywords": [
"microservices",
Expand All @@ -29,6 +29,7 @@
"dotenv": "^16.4.5",
"ethers": "^4.0.49",
"moleculer": "^0.14.26",
"moleculer-auto-openapi": "^1.1.6",
"moleculer-web": "^0.10.4",
"pouchdb": "^9.0.0"
},
Expand Down
4 changes: 3 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ <h1 class="display-6" style="padding-top: 12px;"><span style="color: #147a50;"><
<path d="M12.096 6.223A4.92 4.92 0 0 0 13 5.698V7c0 .289-.213.654-.753 1.007a4.493 4.493 0 0 1 1.753.25V4c0-1.007-.875-1.755-1.904-2.223C11.022 1.289 9.573 1 8 1s-3.022.289-4.096.777C2.875 2.245 2 2.993 2 4v9c0 1.007.875 1.755 1.904 2.223C4.978 15.71 6.427 16 8 16c.536 0 1.058-.034 1.555-.097a4.525 4.525 0 0 1-.813-.927C8.5 14.992 8.252 15 8 15c-1.464 0-2.766-.27-3.682-.687C3.356 13.875 3 13.373 3 13v-1.302c.271.202.58.378.904.525C4.978 12.71 6.427 13 8 13h.027a4.552 4.552 0 0 1 0-1H8c-1.464 0-2.766-.27-3.682-.687C3.356 10.875 3 10.373 3 10V8.698c.271.202.58.378.904.525C4.978 9.71 6.427 10 8 10c.262 0 .52-.008.774-.024a4.525 4.525 0 0 1 1.102-1.132C9.298 8.944 8.666 9 8 9c-1.464 0-2.766-.27-3.682-.687C3.356 7.875 3 7.373 3 7V5.698c.271.202.58.378.904.525C4.978 6.711 6.427 7 8 7s3.022-.289 4.096-.777M3 4c0-.374.356-.875 1.318-1.313C5.234 2.271 6.536 2 8 2s2.766.27 3.682.687C12.644 3.125 13 3.627 13 4c0 .374-.356.875-1.318 1.313C10.766 5.729 9.464 6 8 6s-2.766-.27-3.682-.687C3.356 4.875 3 4.373 3 4"></path>
</svg><span style="background-color: rgb(255, 255, 255);">tydids</span></span><span style="color: #e6b41e;">Consent</span>&nbsp;<span style="color:#303030">Sample Form</span></h1>
</a>

<a href="/api/openapi/ui" class="btn button" style="background-color: #ffffff;margin-top:15px;">
<span style="color: #147a50;">OpenAPI/Swagger</span>
</a>
<template v-if="broker">
<h3>Configuration</h3>
<div class="boxes">
Expand Down
10 changes: 8 additions & 2 deletions services/api.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ module.exports = {
aliases: {
"GET /retrieve": "backend.retrieve",
"GET /granted": "backend.granted"
}

}
}, {
path: '/api/openapi',
aliases: {
'GET /openapi.json': 'openapi.generateDocs', // swagger scheme
'GET /ui': 'openapi.ui', // ui
'GET /assets/:file': 'openapi.assets', // js/css files
},
}
],

Expand Down
29 changes: 29 additions & 0 deletions services/openapi.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const Openapi = require("moleculer-auto-openapi");

module.exports = {
name: 'openapi',
mixins: [Openapi],
settings: {
// all setting optional
openapi: {
info: {
// about project
description: "A lightweight microservice designed to simplify Self-Sovereign Identity (SSI) based consent management in web applications. It acts as a secure intermediary between web forms and backend systems, ensuring compliance with data privacy regulations like GDPR.",
title: "tydids-ssi-consent-router",
},
tags: [
// you tags
{ name: "auth", description: "STROMDAO GmbH <[email protected]>" },
],
components: {
// you auth
securitySchemes: {
myBasicAuth: {
type: 'http',
scheme: 'basic',
},
},
},
},
},
}

0 comments on commit 61718dc

Please sign in to comment.