diff --git a/other/default/sequence/definitions/sd01/sd01.md.tmpl b/document/default/sequence/definitions/sd01/sd01.md.tmpl similarity index 100% rename from other/default/sequence/definitions/sd01/sd01.md.tmpl rename to document/default/sequence/definitions/sd01/sd01.md.tmpl diff --git a/other/default/sequence/definitions/sd01/sd01.mermaid.tmpl b/document/default/sequence/definitions/sd01/sd01.mermaid.tmpl similarity index 100% rename from other/default/sequence/definitions/sd01/sd01.mermaid.tmpl rename to document/default/sequence/definitions/sd01/sd01.mermaid.tmpl diff --git a/other/default/sequence/definitions/sd02/sd02.mermaid.tmpl b/document/default/sequence/definitions/sd02/sd02.mermaid.tmpl similarity index 100% rename from other/default/sequence/definitions/sd02/sd02.mermaid.tmpl rename to document/default/sequence/definitions/sd02/sd02.mermaid.tmpl diff --git a/other/default/sequence/md_sequence.json b/document/default/sequence/md_sequence.json similarity index 88% rename from other/default/sequence/md_sequence.json rename to document/default/sequence/md_sequence.json index 09b9a13..4938907 100644 --- a/other/default/sequence/md_sequence.json +++ b/document/default/sequence/md_sequence.json @@ -1,6 +1,6 @@ { "name": "sd01", - "guide": "https://docs.qaskx.one/templates/sequence/markdown", + "guide": "{{.SelfFolder}}/sd01.md", "description": "Markdown sequence template with embedded mermaid", "templates": [ { diff --git a/other/default/sequence/mermaid_sequence.json b/document/default/sequence/mermaid_sequence.json similarity index 88% rename from other/default/sequence/mermaid_sequence.json rename to document/default/sequence/mermaid_sequence.json index 6d30446..dadd512 100644 --- a/other/default/sequence/mermaid_sequence.json +++ b/document/default/sequence/mermaid_sequence.json @@ -1,6 +1,6 @@ { "name": "sd02", - "guide": "https://docs.qaskx.one/templates/sequence/mermaid", + "guide": "{{.SelfFolder}}/sd02.md", "description": "Mermaid sequence template", "templates": [ { diff --git a/generator/default/build/definitions/woodpecker/woodpecker-docker.yaml b/generator/default/build/definitions/woodpecker/woodpecker-docker.yaml index 32cd545..697c650 100644 --- a/generator/default/build/definitions/woodpecker/woodpecker-docker.yaml +++ b/generator/default/build/definitions/woodpecker/woodpecker-docker.yaml @@ -12,7 +12,7 @@ steps: - GOARCH=amd64 commands: - go get - - go build + - go build -o {{.ExecutableName}} # Runs a dryrun to build the docker container dryrun-docker: diff --git a/generator/default/build/definitions/woodpecker/woodpecker.yaml b/generator/default/build/definitions/woodpecker/woodpecker.yaml index 5077ce4..c376891 100644 --- a/generator/default/build/definitions/woodpecker/woodpecker.yaml +++ b/generator/default/build/definitions/woodpecker/woodpecker.yaml @@ -8,6 +8,6 @@ steps: commands: - go download - go get - - go build -o {{.AssetName}} .\... + - go build -o {{.ExecutableName}} .\... # Optional: Run go tests - go test .\... diff --git a/generator/default/build/readme.md b/generator/default/build/readme.md index 55e0a94..0b762e6 100644 --- a/generator/default/build/readme.md +++ b/generator/default/build/readme.md @@ -1,7 +1,7 @@ ## Build Golang Templates The template files (*.json) listed here are for various -templease created for Golang projects. +templeates created for Golang projects. The templates are basic in construct and capability. diff --git a/other/default/other/definitions/sd01/sd01.md.tmpl b/other/default/other/definitions/sd01/sd01.md.tmpl new file mode 100644 index 0000000..5784ed2 --- /dev/null +++ b/other/default/other/definitions/sd01/sd01.md.tmpl @@ -0,0 +1,52 @@ +# Sequence diagram + +This represents the sequence diagram for +service names {{ range .ServiceNames}}**{{.}}** {{ end }} + +```mermaid +sequenceDiagram + + participant consumer as Consumer + participant gateway as Gateway + participant microservice as ServiceName + participant feature as Svc Feature + participant authz as Authorisation + participant log as Logger +{{ range .Apis}}participant {{ .Name }} as Svc{{ .Name }} +{{ end }} + + consumer->>+gateway: {{.ServicePoints}} + activate consumer + + note right of gateway: Authentication check at GW + gateway->>+microservice: {{.ServicePoints}} + + microservice->>+authz: Validate requestor + note right of authz: Authorise to function + authz-->>-microservice: 200 or 401/403 status + + microservice->>+feature: Check feature switch + feature-->>-microservice: 200 or 401/403 status + + microservice-)log: log request/response + {{ range .Apis}} + microservice-->>+{{ .Name }}: link {{ .Url }} + note right of {{ .Name }}: Explanation of what happens + {{ .Name }}-->>-microservice: 200 OK response + {{ end }} + + alt 200 OK + microservice-->>gateway: 200 OK response + gateway-->>consumer: 200 OK response + else not OK, error + microservice-->>-gateway: !200 ERR response + gateway-->>-consumer: !200 ERR response + end + deactivate consumer + +``` + +***Note***: Adjust the default sequence diagram above + +Copyright {{.QaskxDot.ServiceOwner}} +Contact {{.QaskxDot.ServiceOwnerEmail}} diff --git a/other/default/other/definitions/sd01/sd01.mermaid.tmpl b/other/default/other/definitions/sd01/sd01.mermaid.tmpl new file mode 100644 index 0000000..4f37da5 --- /dev/null +++ b/other/default/other/definitions/sd01/sd01.mermaid.tmpl @@ -0,0 +1,39 @@ + +%% Service name {{.ServicePoints}} +{{ range .Apis}} + +%% Sequence diagram for {{ .ServiceId }} as Svc {{ .Name }} +sequenceDiagram + + participant consumer as Consumer + participant gateway as Gateway + participant microservice as {{$.ServiceNames}} + {{ range $.Depends}} + participant {{ .ServiceId }} as Svc {{ .Name }}{{ end }} + + consumer->>+gateway: {{$.ServicePoints}} + + note right of gateway: Authentication check at GW + gateway->>+microservice: {{$.ServicePoints}} + + microservice->>+authz: Validate requestor + note right of authz: Authorise to function + authz-->>-microservice: 200 or 401/403 status + + microservice->>+feature: Check feature switch + feature-->>-microservice: 200 or 401/403 status + + microservice->>log: log request/response + + microservice-->>+{{ .ServiceId }}: link {{ .Url }} + note right of {{ .ServiceId }}: Explanation of what happens + {{ .ServiceId }}-->>-microservice: 200 OK response + + alt 200 OK + microservice-->>gateway: 200 OK response + gateway-->>-consumer: 200 OK response + else not OK, error + microservice-->>-gateway: !200 ERR response + gateway-->>-consumer: !200 ERR response + end +{{ end }} diff --git a/other/default/other/definitions/sd02/sd02.mermaid.tmpl b/other/default/other/definitions/sd02/sd02.mermaid.tmpl new file mode 100644 index 0000000..66e2c41 --- /dev/null +++ b/other/default/other/definitions/sd02/sd02.mermaid.tmpl @@ -0,0 +1,52 @@ + +%% {{.ServiceName}} service sequence +sequenceDiagram + + participant consumer as Consumer + participant gateway as Gateway +{{ range .Apis}}participant {{ .ServiceId }} as {{.Name}} +{{ end }} +{{ range .Depends}}participant {{ .ServiceId }} as Svc {{ .Name }} +{{ end }} + +{{ range .Apis}} + rect rgb(191, 223, 255) + consumer->>+gateway: {{$.ServicePoints}} + + note right of gateway: Authentication check at GW + gateway->>+authz: Validate requestor + authz-->>-gateway: 200 or 401/403 status + + gateway->>+{{ .ServiceId }}: start + {{ .ServiceId }}->>+authz: Fine grained authz + note right of authz: Authorise to function, data + authz-->>-{{ .ServiceId }}: 200 or 401/403 status + + {{ .ServiceId }}->>+featureflag: Check feature switch + featureflag-->>-{{ .ServiceId }}: 200 or 401/403 status + + {{ .ServiceId }}->>logger: log request/response + + {{ .ServiceId }}->>{{ .ServiceId }}: business logic + note right of {{ .ServiceId }}: Explanation of what happens + + {{with $microservice := .ServiceId }} + {{ range $.Depends }}{{ $microservice }}->>+{{ .ServiceId }}: function call + {{ .ServiceId }}-->>- {{ $microservice }}: result, 200 or 4xx status + {{ end }} + {{ end }} + + {{ .ServiceId }}->>{{ .ServiceId }}: business logic + note right of {{ .ServiceId }}: Explanation of what happens + + alt 200 OK + {{ .ServiceId }}-->>-gateway: 200 OK response + gateway-->>-consumer: 200 OK response + else not OK, error + {{ .ServiceId }}-->>-gateway: !200 ERR response + gateway-->>-consumer: !200 ERR response + end + + end +{{ end }} + \ No newline at end of file diff --git a/other/default/other/md_sequence.json b/other/default/other/md_sequence.json new file mode 100644 index 0000000..4938907 --- /dev/null +++ b/other/default/other/md_sequence.json @@ -0,0 +1,20 @@ +{ + "name": "sd01", + "guide": "{{.SelfFolder}}/sd01.md", + "description": "Markdown sequence template with embedded mermaid", + "templates": [ + { + "engine": "", + "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}", + "file_name": "sd01.md.tmpl", + "output_folder": "^/docs", + "output_name": "seqdgm01.md", + "section": "", + "model": { + "activity": { + "category": "OTHER" + } + } + } + ] +} \ No newline at end of file diff --git a/other/default/other/mermaid_sequence.json b/other/default/other/mermaid_sequence.json new file mode 100644 index 0000000..dadd512 --- /dev/null +++ b/other/default/other/mermaid_sequence.json @@ -0,0 +1,20 @@ +{ + "name": "sd02", + "guide": "{{.SelfFolder}}/sd02.md", + "description": "Mermaid sequence template", + "templates": [ + { + "engine": "", + "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}", + "file_name": "sd02.mermaid.tmpl", + "output_folder": "^/docs", + "output_name": "seqdgm02.mermaid", + "section": "", + "model": { + "activity": { + "category": "OTHER" + } + } + } + ] +} \ No newline at end of file