Compare commits
7 Commits
key-user-e
...
add/custom
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a6f4b71b3 | ||
|
|
c796bda9ad | ||
|
|
8852c91406 | ||
|
|
a7ab8b3bda | ||
|
|
b2b4907b4a | ||
|
|
69126b94af | ||
|
|
8b0f6010a5 |
@@ -1,7 +1,7 @@
|
|||||||
using { Currency, managed, sap, extensible } from '@sap/cds/common';
|
using { Currency, managed, sap } from '@sap/cds/common';
|
||||||
namespace sap.capire.bookshop;
|
namespace sap.capire.bookshop;
|
||||||
|
|
||||||
entity Books : managed, extensible {
|
entity Books : managed {
|
||||||
key ID : Integer;
|
key ID : Integer;
|
||||||
title : localized String(111);
|
title : localized String(111);
|
||||||
descr : localized String(1111);
|
descr : localized String(1111);
|
||||||
@@ -13,7 +13,7 @@ entity Books : managed, extensible {
|
|||||||
image : LargeBinary @Core.MediaType : 'image/png';
|
image : LargeBinary @Core.MediaType : 'image/png';
|
||||||
}
|
}
|
||||||
|
|
||||||
entity Authors : managed, extensible {
|
entity Authors : managed {
|
||||||
key ID : Integer;
|
key ID : Integer;
|
||||||
name : String(111);
|
name : String(111);
|
||||||
dateOfBirth : Date;
|
dateOfBirth : Date;
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"passport": "0.4.1"
|
"passport": "0.4.1"
|
||||||
},
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@cds/cds-plugin-openapi": "*"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"genres": "cds serve test/genres.cds",
|
"genres": "cds serve test/genres.cds",
|
||||||
"start": "cds run",
|
"start": "cds run",
|
||||||
|
|||||||
29
cds-plugin-openapi/index.js
Normal file
29
cds-plugin-openapi/index.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable require-await */
|
||||||
|
const cds = require('@sap/cds'), { BuildTaskHandler } = cds.build
|
||||||
|
const cdsdk = require('@sap/cds-dk')
|
||||||
|
|
||||||
|
cds.build.register(class OpenApiHandler extends BuildTaskHandler {
|
||||||
|
static get meta() {
|
||||||
|
return {
|
||||||
|
id: 'openapi',
|
||||||
|
runWith: ['node-cf', 'java-cf'],
|
||||||
|
config: { src: cds.env.folders.srv.replace(/\/$/, '') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async clean() {
|
||||||
|
return this.remove('openapi-docs')
|
||||||
|
}
|
||||||
|
async build() {
|
||||||
|
const model = await this.model()
|
||||||
|
const { options } = this.task
|
||||||
|
|
||||||
|
// generate openapi files for all services
|
||||||
|
await Promise.all(cds.linked(model).services.map(service => {
|
||||||
|
const openApi = cdsdk.compile.to.openapi(model, {
|
||||||
|
service: service.name,
|
||||||
|
'openapi:diagram': String(options.diagram) === 'true'
|
||||||
|
})
|
||||||
|
this.write(openApi).to(`openapi-docs/${service.name}.openapi3.json`)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
})
|
||||||
9
cds-plugin-openapi/package.json
Normal file
9
cds-plugin-openapi/package.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "@sap/cds-plugin-openapi",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "OpenAPI service specification build plugin",
|
||||||
|
"main": "index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"@sap/cds-dk": "^4"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,10 +50,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sap.ui5": {
|
"sap.ui5": {
|
||||||
"flexEnabled": true,
|
|
||||||
"config": {
|
|
||||||
"experimentalCAPScenario": true
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"minUI5Version": "1.81.0",
|
"minUI5Version": "1.81.0",
|
||||||
"libs": {
|
"libs": {
|
||||||
|
|||||||
@@ -22,10 +22,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sap.ui5": {
|
"sap.ui5": {
|
||||||
"flexEnabled": true,
|
|
||||||
"config": {
|
|
||||||
"experimentalCAPScenario": true
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"libs": {
|
"libs": {
|
||||||
"sap.fe.templates": {}
|
"sap.fe.templates": {}
|
||||||
|
|||||||
@@ -10,21 +10,7 @@
|
|||||||
<script>
|
<script>
|
||||||
window["sap-ushell-config"] = {
|
window["sap-ushell-config"] = {
|
||||||
defaultRenderer: "fiori2",
|
defaultRenderer: "fiori2",
|
||||||
applications: {},
|
applications: {}
|
||||||
bootstrapPlugins: {
|
|
||||||
RuntimeAuthoringPlugin: {
|
|
||||||
component: "sap.ushell.plugins.rta",
|
|
||||||
config: {
|
|
||||||
validateAppVersion: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
PersonalizePlugin: {
|
|
||||||
component: "sap.ushell.plugins.rta-personalize",
|
|
||||||
config: {
|
|
||||||
validateAppVersion: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -36,13 +22,8 @@
|
|||||||
data-sap-ui-frameOptions="allow"
|
data-sap-ui-frameOptions="allow"
|
||||||
></script>
|
></script>
|
||||||
<script>
|
<script>
|
||||||
sap.ui.getCore().attachInit(()=> sap.ushell.Container.createRenderer().placeAt("content"));
|
sap.ui.getCore().attachInit(()=> sap.ushell.Container.createRenderer().placeAt("content"))
|
||||||
sap.ui
|
</script>
|
||||||
.getCore()
|
|
||||||
.getConfiguration()
|
|
||||||
.setFlexibilityServices([{ connector: "SessionStorageConnector" }]);
|
|
||||||
sap.ui.getCore().getConfiguration().setLanguage("en");
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="sapUiBody" id="content"></body>
|
<body class="sapUiBody" id="content"></body>
|
||||||
|
|||||||
@@ -13,9 +13,6 @@
|
|||||||
},
|
},
|
||||||
"cds": {
|
"cds": {
|
||||||
"requires": {
|
"requires": {
|
||||||
"extensibility": {
|
|
||||||
"kind": "uiflex"
|
|
||||||
},
|
|
||||||
"auth": {
|
"auth": {
|
||||||
"strategy": "dummy"
|
"strategy": "dummy"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,13 +13,14 @@
|
|||||||
"@capire/media": "./media",
|
"@capire/media": "./media",
|
||||||
"@capire/orders": "./orders",
|
"@capire/orders": "./orders",
|
||||||
"@capire/reviews": "./reviews",
|
"@capire/reviews": "./reviews",
|
||||||
"@sap/cds": "^5.5.3"
|
"@sap/cds": "git+https://github.tools.sap/cap/cds#add/customBuildTaskProviders"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"chai-subset": "^1.6.0",
|
"chai-subset": "^1.6.0",
|
||||||
"sqlite3": "^5"
|
"sqlite3": "^5",
|
||||||
|
"@cds/cds-plugin-openapi": "./cds-plugin-openapi"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"cleanup": "rm -rf node_modules && rm -rf */node_modules && rm -rf */*/node_modules",
|
"cleanup": "rm -rf node_modules && rm -rf */node_modules && rm -rf */*/node_modules",
|
||||||
@@ -30,7 +31,6 @@
|
|||||||
"media": "cds watch media",
|
"media": "cds watch media",
|
||||||
"mocha": "npx mocha || echo",
|
"mocha": "npx mocha || echo",
|
||||||
"jest": "npx jest",
|
"jest": "npx jest",
|
||||||
"start": "cds watch fiori",
|
|
||||||
"test": "npm run jest -- --silent",
|
"test": "npm run jest -- --silent",
|
||||||
"test:hello": "cd hello && npm test"
|
"test:hello": "cd hello && npm test"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user