Merge pull request #247 from SAP-samples/openapi

OpenAPI and Swagger UI
This commit is contained in:
Christian Georgi
2021-07-12 14:04:30 +02:00
committed by GitHub
5 changed files with 18550 additions and 92 deletions

2
.gitignore vendored
View File

@@ -15,3 +15,5 @@ default-env.json
packages/messageBox
reviews/msg-box
reviews/db/test.db
*.openapi3.json

View File

@@ -1,4 +1,5 @@
const cds = require ('@sap/cds')
module.exports = cds.server
cds.once('bootstrap',(app)=>{
app.use ('/orders/webapp', _from('@capire/orders/app/orders/webapp/manifest.json'))
@@ -8,7 +9,11 @@ cds.once('bootstrap',(app)=>{
cds.once('served', require('./srv/mashup'))
module.exports = cds.server
// Swagger UI - see https://cap.cloud.sap/docs/advanced/openapi
if (process.env.NODE_ENV !== 'production') {
const cds_swagger = require ('cds-swagger-ui-express')
cds.once ('bootstrap', app => app.use (cds_swagger()) )
}
// -----------------------------------------------------------------------

18629
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,7 @@
"express": "^4"
},
"devDependencies": {
"cds-swagger-ui-express": "^0.2.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0",
@@ -28,7 +29,7 @@
"fiori": "cds watch fiori",
"media": "cds watch media",
"mocha": "npx mocha || echo",
"jest": "npx jest@^26",
"jest": "npx jest",
"test": "npm run jest --silent"
},
"mocha": {

View File

@@ -63,6 +63,7 @@ Each sub directory essentially is an individual npm package arranged in an [all-
- Support for [Value Helps](https://cap.cloud.sap/docs/guides/fiori#value-help)
- Serving SAP Fiori apps locally
- [The Vue.js app](bookshop/app/vue) imported from bookshop is served as well
- [OpenAPI export + Swagger UI](https://cap.cloud.sap/docs/advanced/openapi)
<br>