Skip to content

Commit 493b198

Browse files
authored
Merge pull request #14 from Backbase/wa3-openapi-integration
Wa3 openapi integration
2 parents 5af0091 + 0d35f21 commit 493b198

File tree

8 files changed

+697
-24
lines changed

8 files changed

+697
-24
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
target/
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env groovy
2+
3+
pipeline {
4+
agent any
5+
6+
tools {
7+
maven 'maven'
8+
nodejs 'node'
9+
}
10+
11+
environment {
12+
BACKBASE_REGISTRY = "https://repo.backbase.com/api/npm/npm-backbase/"
13+
PUBLISH_REGISTRY = "https://myregistry.backbase.com/"
14+
RELEASE_BRANCH_PATTERN = /^(master|release\/.*)$/
15+
}
16+
17+
stages {
18+
stage('Build') {
19+
steps {
20+
script {
21+
sh 'mvn clean compile'
22+
dir('target/generated-sources/openapi') {
23+
sh "npm install --@backbase:registry=${BACKBASE_REGISTRY}"
24+
sh "npm run build"
25+
}
26+
}
27+
}
28+
}
29+
30+
stage('Update API') {
31+
when { not { expression { BRANCH_NAME ==~ RELEASE_BRANCH_PATTERN } } }
32+
steps {
33+
script {
34+
dir('typescript-angular-api') {
35+
sh "npm install"
36+
sh "npm run api:extract"
37+
sh "git add ."
38+
gitChanges = sh(returnStatus: true, script: 'git diff --staged --exit-code -- .')
39+
if (gitChanges != 0) {
40+
sh "git commit -m 'Updated typescript API'"
41+
sh "git push origin HEAD:${env.BRANCH_NAME}"
42+
}
43+
}
44+
}
45+
}
46+
}
47+
48+
stage('Test') {
49+
steps {
50+
script {
51+
dir('typescript-angular-api') {
52+
sh "npm install"
53+
sh "npm run api:check"
54+
}
55+
}
56+
}
57+
}
58+
59+
stage('Deploy') {
60+
when { expression { BRANCH_NAME ==~ RELEASE_BRANCH_PATTERN } }
61+
steps {
62+
script {
63+
dir('target/generated-sources/openapi/dist') {
64+
sh "npm publish --registry ${PUBLISH_REGISTRY}"
65+
}
66+
}
67+
}
68+
}
69+
}
70+
}

service-sdk/10.0.0/migrate-to-open-api/messaging-api/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,44 @@ Fill out this file with some information about your OpenAPI spec.
44

55
To build this spec, use:
66
- mvn spring-boot:run
7+
8+
## Frontend Code Generation
9+
10+
### Generate and Build
11+
12+
Code is generated using [openapi-generator](https://openapi-generator.tech/).
13+
14+
```bash
15+
mvn clean compile
16+
cd target/generated-sources/openapi
17+
npm install --@backbase:registry=https://repo.backbase.com/api/npm/npm-backbase/
18+
npm run build
19+
```
20+
21+
### Public API Report
22+
23+
Public API report is created using [api-extractor](https://www.npmjs.com/package/@microsoft/api-extractor).
24+
25+
*Note*: First run the code generation.
26+
27+
```bash
28+
cd typescript-angular-api
29+
npm install
30+
npm run api:check
31+
```
32+
33+
### Publish
34+
35+
After generating the `dist` of the generated sources can be published.
36+
37+
```
38+
cd target/generated-sources/openapi/dist
39+
npm publish
40+
```
41+
42+
## Example Pipeline
43+
44+
The `Jenkinsfile` contains an example pipeline which executes the above steps. It may need to be configured furher to suit your environment. As it is configured it will:
45+
- Generate and build the frontend code
46+
- If not on a release branch, update the public API report
47+
- If on a release branch, verify the public API report and publish the generated package

service-sdk/10.0.0/migrate-to-open-api/messaging-api/pom.xml

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,34 @@
1414
<version>1.0.0-SNAPSHOT</version>
1515
<name>Backbase :: Digital Banking Services :: messaging-api</name>
1616

17-
<dependencies>
18-
<dependency>
19-
<groupId>io.swagger</groupId>
20-
<artifactId>swagger-annotations</artifactId>
21-
<version>1.6.0</version>
22-
</dependency>
23-
24-
<dependency>
25-
<groupId>org.openapitools</groupId>
26-
<artifactId>jackson-databind-nullable</artifactId>
27-
<version>0.2.1</version>
28-
</dependency>
29-
</dependencies>
17+
<properties>
18+
<codegen.npmPackage.name>@backbase/message-http-ang</codegen.npmPackage.name>
19+
<codegen.npmPackage.version>${version}</codegen.npmPackage.version>
20+
<codegen.generateMocks>true</codegen.generateMocks>
21+
<codegen.apiModulePrefix>Message</codegen.apiModulePrefix>
22+
<codegen.angularVersion>10.1.0</codegen.angularVersion>
23+
<codegen.buildDist>dist/libs/transactions-http-ang</codegen.buildDist>
24+
<codegen.serviceSuffix>HttpService</codegen.serviceSuffix>
25+
</properties>
3026

3127
<build>
3228
<plugins>
3329
<plugin>
34-
<groupId>org.openapitools</groupId>
35-
<artifactId>openapi-generator-maven-plugin</artifactId>
30+
<groupId>com.backbase.oss</groupId>
31+
<artifactId>boat-maven-plugin</artifactId>
32+
<version>0.14.0</version>
3633
<executions>
3734
<execution>
38-
<id>generate-client-api-code</id>
3935
<goals>
4036
<goal>generate</goal>
4137
</goals>
38+
<configuration>
39+
<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
40+
<generatorName>typescript-angular</generatorName>
41+
<additionalProperties>ngVersion=${codegen.angularVersion},npmName=${codegen.npmPackage.name},npmVersion=${codegen.npmPackage.version},withMocks=${codegen.generateMocks},apiModulePrefix=${codegen.apiModulePrefix},buildDist=${codegen.buildDist},serviceSuffix=${codegen.serviceSuffix}</additionalProperties>
42+
</configuration>
4243
</execution>
4344
</executions>
44-
<configuration>
45-
<inputSpec>src/main/resources/openapi.yaml</inputSpec>
46-
<output>${project.build.directory}/generated-sources/api</output>
47-
<configOptions>
48-
<apiPackage>message</apiPackage>
49-
<modelPackage>message.model</modelPackage>
50-
</configOptions>
51-
</configuration>
5245
</plugin>
5346
<!--maven-jar-plugin is only including the OpenAPI spec and examples in the built artifact -->
5447
<plugin>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"projectFolder": "../target/generated-sources/openapi",
4+
"mainEntryPointFilePath": "<projectFolder>/dist/public_api.d.ts",
5+
"bundledPackages": [],
6+
"compiler": {
7+
"tsconfigFilePath": "<projectFolder>/tsconfig.json"
8+
},
9+
"apiReport": {
10+
"enabled": true,
11+
"reportFolder": ".",
12+
"reportTempFolder": "<projectFolder>/temp/"
13+
},
14+
"docModel": {
15+
"enabled": false
16+
},
17+
"dtsRollup": {
18+
"enabled": false
19+
},
20+
"tsdocMetadata": {
21+
"enabled": false
22+
},
23+
"messages": {
24+
"compilerMessageReporting": {
25+
"default": {
26+
"logLevel": "warning"
27+
}
28+
},
29+
"extractorMessageReporting": {
30+
"default": {
31+
"logLevel": "warning"
32+
},
33+
"ae-missing-release-tag": {
34+
"logLevel": "none",
35+
"addToApiReportFile": false
36+
},
37+
"ae-forgotten-export": {
38+
"logLevel": "warning",
39+
"addToApiReportFile": true
40+
},
41+
"ae-incompatible-release-tags": {
42+
"logLevel": "none",
43+
"addToApiReportFile": false
44+
},
45+
"ae-internal-missing-underscore": {
46+
"logLevel": "none",
47+
"addToApiReportFile": false
48+
},
49+
"ae-unresolved-inheritdoc-reference": {
50+
"logLevel": "none",
51+
"addToApiReportFile": false
52+
},
53+
"ae-unresolved-inheritdoc-base": {
54+
"logLevel": "none",
55+
"addToApiReportFile": false
56+
}
57+
},
58+
"tsdocMessageReporting": {
59+
"default": {
60+
"logLevel": "warning"
61+
},
62+
"tsdoc-unsupported-tag": {
63+
"logLevel": "none"
64+
},
65+
"tsdoc-undefined-tag": {
66+
"logLevel": "none"
67+
},
68+
"tsdoc-param-tag-missing-hyphen": {
69+
"logLevel": "none"
70+
},
71+
"tsdoc-malformed-inline-tag": {
72+
"logLevel": "none"
73+
},
74+
"tsdoc-escape-right-brace": {
75+
"logLevel": "none"
76+
}
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)