diff --git a/api/alternative/default.json b/api/alternative/default.json new file mode 100644 index 0000000..66c1ea7 --- /dev/null +++ b/api/alternative/default.json @@ -0,0 +1,20 @@ +{ + "name": "default", + "guide": "{{.SelfFolder}}/errm01.md", + "description": "Default error model", + "templates": [ + { + "engine": "", + "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}", + "file_name": "error-model.tmpl", + "output_folder": "", + "output_name": "", + "section": "", + "model": { + "activity": { + "category": "OTHER" + } + } + } + ] +} \ No newline at end of file diff --git a/api/alternative/default/definitions/error-model.tmpl b/api/alternative/default/definitions/error-model.tmpl new file mode 100644 index 0000000..5784ed2 --- /dev/null +++ b/api/alternative/default/definitions/error-model.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/api/alternative/error-model.json b/api/alternative/error-model.json new file mode 100644 index 0000000..5be26ba --- /dev/null +++ b/api/alternative/error-model.json @@ -0,0 +1,20 @@ +{ + "name": "error-model", + "guide": "{{.SelfFolder}}/error-model.md", + "description": "Default error model", + "templates": [ + { + "engine": "", + "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}", + "file_name": "error-model.tmpl", + "output_folder": "", + "output_name": "", + "section": "", + "model": { + "activity": { + "category": "OTHER" + } + } + } + ] +} \ No newline at end of file diff --git a/api/alternative/error-model/definitions/error-model.tmpl b/api/alternative/error-model/definitions/error-model.tmpl new file mode 100644 index 0000000..c6f914a --- /dev/null +++ b/api/alternative/error-model/definitions/error-model.tmpl @@ -0,0 +1,6 @@ +{ +"description": "Standard error model", +"example": 25, +"format": "integer", +"type": "number" +} \ No newline at end of file diff --git a/api/default/error-model.json b/api/default/error-model.json new file mode 100644 index 0000000..86335fb --- /dev/null +++ b/api/default/error-model.json @@ -0,0 +1,20 @@ +{ + "name": "error-model", + "guide": "{{.SelfFolder}}/error-model.md", + "description": "Default error model", + "templates": [ + { + "engine": "", + "folder": "{{.SelfFolder}}/{{.TemplateName}}/definitions", + "file_name": "error-model.tmpl", + "output_folder": "", + "output_name": "", + "section": "", + "model": { + "activity": { + "category": "OTHER" + } + } + } + ] +} \ No newline at end of file diff --git a/api/default/error-model/error-model.json b/api/error-model/error-model.json similarity index 79% rename from api/default/error-model/error-model.json rename to api/error-model/error-model.json index 2c8e2f4..b6f141b 100644 --- a/api/default/error-model/error-model.json +++ b/api/error-model/error-model.json @@ -1,5 +1,5 @@ { - "name": "errm01", + "name": "error-model", "guide": "{{.SelfFolder}}/errm01.md", "description": "Default error model", "templates": [ @@ -7,8 +7,8 @@ "engine": "", "folder": "{{.SelfFolder}}/definitions/{{.TemplateName}}", "file_name": "error-model.tmpl", - "output_folder": "^/docsxxx", - "output_name": "seqdgm01.md", + "output_folder": "", + "output_name": "", "section": "", "model": { "activity": { diff --git a/api/error-model/error-model/definitions/error-model.tmpl b/api/error-model/error-model/definitions/error-model.tmpl new file mode 100644 index 0000000..5784ed2 --- /dev/null +++ b/api/error-model/error-model/definitions/error-model.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}}