Skip to content

Commit 0ca1149

Browse files
committed
Documenting company bpmn / api.
1 parent 47f1780 commit 0ca1149

File tree

11 files changed

+121
-36
lines changed

11 files changed

+121
-36
lines changed

.scalafmt.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ assumeStandardLibraryStripMargin = true
77
binPack.literalsExclude = ["Term.Name"]
88

99
maxColumn = 100 // For my wide 30" display.
10+
# align arrows in for comprehensions
11+
align.preset = most
1012

1113
newlines.source = keep
1214
rewrite.scala3.convertToNewSyntax = true

00-docs/src/docs/company/02-bpmn.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
1-
# 02-bpmn
1+
# 02-bpmn
2+
3+
Use this to add Company specific BPMN stuff like business objects used in all projects.
4+
5+
The following structure is generated by `../helperCompany.scala init`:
6+
7+
```bash
8+
02-bpmn/src
9+
| main/resources
10+
| main/scala/company/bpmn
11+
| | CompanyBpmnDsl.scala
12+
| test/scala/company/bpmn
13+
```
14+
15+
## CompanyBpmnDsl
16+
17+
Provide some Company specific things for the BPMN DSL, like additional Documentation, like Links to Specifications.
18+
19+
Example:
20+
21+
```scala mdoc
22+
import camundala.bpmn.BpmnDsl
23+
24+
trait CompanyBpmnDsl extends BpmnDsl:
25+
26+
def postmanRef: Option[String] = None
27+
def specPage: Option[String] = None
28+
29+
override def companyDescr =
30+
s"""
31+
|${postmanRef.map(r => s"[Test Client (Postman)]($postmanRef)").mkString}
32+
|
33+
|${specPage.map(sp => s"**[Specification (Confluence)]($sp)**").mkString}
34+
|""".stripMargin
35+
end companyDescr
36+
37+
end CompanyBpmnDsl
38+
```
39+
40+
@:callout(info)
41+
Documentation of `companyDescr` will be in every BPMN element you define by the DSL, e.g. processes or workers.
42+
@:@

00-docs/src/docs/company/03-api.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,52 @@
1-
# 03-api
1+
# 03-api
2+
Use this to add Company specific API stuff like the configuration of the projects within the Company.
3+
4+
The following structure is generated by `../helperCompany.scala init`:
5+
6+
```bash
7+
03-api/src
8+
| main/resources
9+
| main/scala/company/api
10+
| | CompanyApiCreator.scala
11+
| test/scala/company/api
12+
```
13+
14+
## CompanyApiCreator
15+
16+
The Company's base class to generate the API documentation and API Clients for Postman.
17+
18+
Example:
19+
20+
```scala mdoc
21+
import camundala.api.*
22+
23+
trait CompanyApiCreator extends ApiCreator, ApiDsl, CamundaPostmanApiCreator:
24+
25+
// override the config if needed
26+
protected def apiConfig: ApiConfig = CompanyApiCreator.apiConfig
27+
28+
lazy val companyDescr = ??? //TODO Add your Company Description!
29+
30+
object CompanyApiCreator:
31+
lazy val apiConfig = ApiConfig(companyId = "mycompany")
32+
end CompanyApiCreator
33+
```
34+
35+
## ApiConfig
36+
You can define the project structure.
37+
38+
Here an example:
39+
40+
```scala mdoc
41+
import camundala.api.*
42+
43+
lazy val apiConfig =
44+
ApiConfig(companyId = "mycompany")
45+
46+
47+
```
48+
49+
50+
@:callout(info)
51+
Documentation of `companyDescr` will be in every API documentation. So ones per project.
52+
@:@

03-api/src/main/scala/camundala/api/ApiConfig.scala

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ case class ApiConfig(
1414
endpoint: String = "http://localhost:8080/engine-rest",
1515
// Base Path of your project (if changed - all doc paths will be adjusted)
1616
basePath: os.Path = os.pwd,
17-
openApiPath: os.Path = os.pwd / "openApi.yml",
18-
postmanOpenApiPath: os.Path = os.pwd / "postmanOpenApi.yml",
19-
openApiDocuPath: os.Path = os.pwd / "OpenApi.html",
20-
postmanOpenApiDocuPath: os.Path = os.pwd / "PostmanOpenApi.html",
2117
// If you work with JIRA, you can add matchers that will create automatically URLs to JIRA Tasks
2218
jiraUrls: Map[String, String] = Map.empty,
2319
// Configure your project setup
@@ -37,10 +33,15 @@ case class ApiConfig(
3733
// function to extract project and the reference id from a reference (CallActivity, Dmn or ExternalWorker)
3834
// default returns the first part of the reference as project (e.g. mycompany from mycompany-product)
3935
projectRefId: String => (String, String) =
40-
pr => pr.split("-").head -> pr
36+
pr => pr.split("-").head -> pr,
4137
):
4238
val catalogPath: os.Path = basePath / catalogFileName
4339

40+
lazy val openApiPath: os.Path = basePath / "03-api" / "OpenApi.yml"
41+
lazy val postmanOpenApiPath: os.Path = basePath / "03-api" / "PostmanOpenApi.yml"
42+
lazy val openApiDocuPath: os.Path = basePath / "03-api" / "OpenApi.html"
43+
lazy val postmanOpenApiDocuPath: os.Path = basePath / "03-api" / "PostmanOpenApi.html"
44+
4445
lazy val projectGroups: Seq[ProjectGroup] = projectsConfig.projectConfigs
4546
.map(_.group)
4647
.distinct
@@ -51,10 +52,6 @@ case class ApiConfig(
5152
def withBasePath(path: os.Path): ApiConfig =
5253
copy(
5354
basePath = path,
54-
openApiPath = path / "openApi.yml",
55-
openApiDocuPath = path / "OpenApi.html",
56-
postmanOpenApiPath = path / "postmanOpenApi.yml",
57-
postmanOpenApiDocuPath = path / "PostmanOpenApi.html"
5855
)
5956

6057
def withEndpoint(ep: String): ApiConfig =

04-helper/src/main/scala/camundala/helper/dev/company/CompanyWrapperGenerator.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ case class CompanyWrapperGenerator()(using config: DevConfig):
2424

2525
private lazy val bpmnWrapper =
2626
s"""package $companyName.camundala.bpmn
27-
|
28-
|import camundala.bpmn.*
29-
|import camundala.domain.*
3027
|
3128
|/**
3229
| * Add here company specific stuff, like documentation or custom elements.
3330
| */
34-
|trait CompanyBpmnDsl
31+
|trait CompanyBpmnDsl:
32+
| // override def companyDescr = ??? //TODO Add your specific Company Description!
33+
|end CompanyBpmnDsl
3534
|
3635
|trait CompanyBpmnProcessDsl extends BpmnProcessDsl, CompanyBpmnDsl
3736
|trait CompanyBpmnServiceTaskDsl extends BpmnServiceTaskDsl, CompanyBpmnDsl
@@ -45,8 +44,6 @@ case class CompanyWrapperGenerator()(using config: DevConfig):
4544

4645
private lazy val apiWrapper =
4746
s"""package $companyName.camundala.api
48-
|
49-
|import camundala.api.*
5047
|
5148
|/**
5249
| * Add here company specific stuff, to create the Api documentation and the Postman collection.

04-helper/src/main/scala/camundala/helper/dev/publish/PublishHelper.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ case class PublishHelper()(using
1616
def publish(version: String): Unit =
1717
println(s"Publishing BPF Package: $version")
1818
verifyVersion(version)
19-
verifySnapshots()
19+
//TODO verifySnapshots()
2020
verifyChangelog(version)
2121
pushDevelop()
2222
setApiVersion(version)
@@ -71,7 +71,7 @@ case class PublishHelper()(using
7171
private def publishToWebserver(): Unit =
7272
// push it to Documentation Webserver
7373
publishConfig.foreach:
74-
ProjectWebDAV(devConfig.projectName, _).upload()
74+
ProjectWebDAV(devConfig.projectName, apiConfig, _).upload()
7575

7676
end PublishHelper
7777

04-helper/src/main/scala/camundala/helper/dev/publish/WebDAV.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ abstract class WebDAV:
3535
end startSession
3636
end WebDAV
3737

38-
case class ProjectWebDAV(projectName: String, publishConfig: PublishConfig) extends WebDAV:
38+
case class ProjectWebDAV(projectName: String, apiConfig: ApiConfig, publishConfig: PublishConfig) extends WebDAV:
3939

4040
val projectUrl = s"$publishBaseUrl/$projectName/"
4141

@@ -58,8 +58,8 @@ case class ProjectWebDAV(projectName: String, publishConfig: PublishConfig) exte
5858
end try
5959
// create new
6060
sardine.createDirectory(projectUrl)
61-
sardine.put(s"$projectUrl/OpenApi.html", openApiHtml, contentTypeHtml)
62-
sardine.put(s"$projectUrl/openApi.yml", openApiYml, contentTypeYaml)
61+
sardine.put(s"${apiConfig.openApiDocuPath}", openApiHtml, contentTypeHtml)
62+
sardine.put(s"${apiConfig.openApiPath}", openApiYml, contentTypeYaml)
6363
postmanApiYml.foreach(pApi =>
6464
sardine.put(
6565
s"$projectUrl/postmanCollection.json",

04-helper/src/main/scala/camundala/helper/dev/update/ApiGenerator.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ case class ApiGenerator()(using config: DevConfig):
99
) / "ApiProjectCreator.scala",
1010
api
1111
)
12-
createOrUpdate(config.projectDir / "OpenApi.html", openApiHtml)
13-
createOrUpdate(config.projectDir / "PostmanOpenApi.html", postmanOpenApiHtml)
12+
createOrUpdate(config.projectDir / "03-api" / "OpenApi.html", openApiHtml)
13+
createOrUpdate(config.projectDir / "03-api" / "PostmanOpenApi.html", postmanOpenApiHtml)
1414
end generate
1515

1616
lazy val api =

04-helper/src/main/scala/camundala/helper/util/VersionHelper.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ case class CompanyVersionHelper(
1010
):
1111

1212
lazy val companyCamundalaVersion: String =
13-
VersionHelper.repoSearch(s"$companyName-camundala-api_3", companyName)
13+
VersionHelper.repoSearch(s"$companyName-camundala-bpmn_3", companyName)
1414

1515
end CompanyVersionHelper
1616

@@ -65,7 +65,7 @@ end VersionHelper
6565
object VersionHelper:
6666

6767
lazy val camundalaVersion: String =
68-
repoSearch("camundala-api_3", "io.github.pme123")
68+
repoSearch("camundala-bpmn_3", "io.github.pme123")
6969

7070
def repoSearch(project: String, org: String): String =
7171
val searchResult = os.proc(

04-helper/src/test/scala/camundala/helper/util/VersionHelperTest.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ class VersionHelperTest extends FunSuite:
77
test("repoSearch".ignore) {
88
assertEquals(
99
VersionHelper.repoSearch("camundala-api_3", "io.github.pme123"),
10-
"1.30.24" // This is the latest released version
11-
)
12-
}
13-
test("repoSearch company") {
14-
assertEquals(
15-
VersionHelper.repoSearch("valiant-camundala-bpmn_3", "valiant"),
16-
"0.18.59" // This is the latest released version
10+
"1.30.25" // This is the latest released version
1711
)
1812
}
1913
test("repoSearch no result") {

build.sbt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ lazy val root = project
4444
lazy val docs =
4545
(project in file("./00-docs"))
4646
.configure(preventPublication)
47-
.settings(projectSettings("docs"))
48-
.settings(laikaSettings)
49-
.settings(mdocSettings)
47+
.settings(
48+
projectSettings("docs"),
49+
autoImportSetting,
50+
laikaSettings,
51+
mdocSettings)
5052
.enablePlugins(LaikaPlugin, MdocPlugin)
53+
.dependsOn(helper)
5154

5255
// layer 01
5356
lazy val domain = project

0 commit comments

Comments
 (0)