Skip to content

Commit

Permalink
Merge pull request #80 from RabotaRu/mustache
Browse files Browse the repository at this point in the history
Mustache
  • Loading branch information
rpiontik authored Aug 19, 2022
2 parents 837de27 + 7dbf914 commit e9e556e
Show file tree
Hide file tree
Showing 33 changed files with 1,110 additions and 225 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"axios": "0.21.1",
"dateformat": "3.0.3",
"jsonata": "1.8.6",
"mustache": "4.2.0",
"swagger-ui": "3.24.3",
"vue": "2.6.11",
"vue-code-diff": "0.0.4",
Expand Down
9 changes: 9 additions & 0 deletions public/documentation/arch/components/examples/context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
contexts:
#***********************************************************
# Контекст-пример сервиса заказов
#***********************************************************
dochub.example:
title: Контектс-пример
components:
- dochub.examples.orders
- dochub.examples.payment
65 changes: 65 additions & 0 deletions public/documentation/arch/components/examples/order.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
components:
#***********************************************************
# Компонент-пример сервиса заказов
#***********************************************************
dochub.examples.orders:
title: Сервис управления заказами
entity: component
technologies:
- PHP
asyncapi: # Кастомное поле, созданное для примера сборки контрактов из архитектуры через шаблоны
# см. https://dochub.info/docs/dochub.templates
servers:
orders:
url: mqtt://order.host.net
protocol: mqtt
description: Orders gateway
channels:
order/create:
subscribe:
operationId: emitOrderCreate
message:
$ref: "#/components/messages/OrderCreate"
components:
messages:
OrderCreate:
name: orderCreate
title: Создание заказа
contentType: application/json
payload:
$ref: "#/components/schemas/order"
schemas:
order:
type: object
properties:
id:
type: string
format: uuid
customer:
type: string
format: uuid
curr:
type: string
description: "Валюта"
value:
type: number
description: "Сумма"
createdAt:
type: string
format: date-time
description: "Момент создания"
openapi: # Кастомное поле, созданное для примера сборки контрактов из архитектуры через шаблоны
# см. https://dochub.info/docs/dochub.templates
paths:
/orders:
get:
summary: Получение списка заказов
responses:
'200': # status code
content:
application/json:
schema:
type: array
items:
type: string
format: uid
65 changes: 65 additions & 0 deletions public/documentation/arch/components/examples/payment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
components:
#***********************************************************
# Компонент-пример сервиса оплаты
#***********************************************************
dochub.examples.payment:
title: Сервис оплаты
entity: component
expert: R.Piontik
technologies:
- SberPay
- Go
asyncapi: # Кастомное поле, созданное для примера сборки контрактов из архитектуры через шаблоны
# см. https://dochub.info/docs/dochub.templates
servers:
payments:
url: mqtt://pay.host.net
protocol: mqtt
description: Payment gateway
channels:
pay/payment:
subscribe:
operationId: emitPayment
message:
$ref: "#/components/messages/Payment"
components:
messages:
Payment:
name: payment
title: Оплата
summary: Сообщение по оплате
contentType: application/json
payload:
$ref: "#/components/schemas/payment"
schemas:
payment:
type: object
properties:
account:
type: string
description: "Номер счета"
curr:
type: string
description: "Валюта"
value:
type: number
description: "Сумма"
createdAt:
type: string
format: date-time
description: "Момент создания"
openapi: # Кастомное поле, созданное для примера сборки контрактов из архитектуры через шаблоны
# см. https://dochub.info/docs/dochub.templates
paths:
/payments:
get:
summary: Получение списка счетов
responses:
'200': # status code
content:
application/json:
schema:
type: array
items:
type: string
format: uid
10 changes: 10 additions & 0 deletions public/documentation/arch/components/examples/root.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#***********************************************************
# Компонет-примеры
#***********************************************************
components:
dochub.examples:
title: Примеры
imports:
- order.yaml
- payment.yaml
- context.yaml
1 change: 1 addition & 0 deletions public/documentation/arch/components/root.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ imports:
- gitlab.yaml
- browser.yaml
- web.yaml
- examples/root.yaml
8 changes: 7 additions & 1 deletion public/documentation/docs/conception/mindmap.puml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@
*** [[/docs/dochub.docs Пользовательские артефакты]]
**** [[/docs/dochub.docs#plantuml Диаграммы, схемы и т.д.]]
***** [[https://plantuml.com/ PlantUML]]
****** [[/docs/dochub.templates#plantuml Шаблоны]]
**** [[/docs/dochub.docs#markdown Документы]]
***** [[https://ru.wikipedia.org/wiki/Markdown Markdown]]
****** [[/docs/dochub.docs#markdown Встраивание объектов DocHub]]
**** [[/docs/dochub.docs#swagger API Контракты]]
****** [[/docs/dochub.templates#markdown Шаблоны]]
**** [[/docs/dochub.tables Таблицы]]
**** [[/docs/dochub.docs#swagger Контракты]]
***** [[https://swagger.io/ Swagger]]
****** [[/docs/dochub.templates#openapi Шаблоны]]
***** [[https://www.asyncapi.com/ AsyncAPI]]
****** [[/docs/dochub.templates#asyncapi Шаблоны]]
@endmindmap
6 changes: 1 addition & 5 deletions public/documentation/docs/manual/datasets.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,4 @@ datasets:
![Зависимый источник](@document/dochub.dataset.li)
[Далее](/docs/dochub.forms)
[Далее](/docs/dochub.jsonata)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"asyncapi": "2.4.0",
"info": {
"title": "Пример генерации асинхронных контрактов",
"version": "1.0.0",
"description": "Информация о контрактах собирается по всей архитектуре"
}
{{#content}}
,"{{field}}":{{&body}}
{{/content}}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"openapi": "3.0.0",
"info": {
"title": "Пример шаблона OpenAPI",
"description": "Контракты собираются из нескольких компонентов архитетуры"
},
"servers": [
{
"url": "http://host.net",
"description": "Сервис заказов"
}
]
{{#content}}
,"{{field}}":{{&body}}
{{/content}}
}
6 changes: 6 additions & 0 deletions public/documentation/docs/manual/docs/examples/template.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@startuml
title Сущности использованные при описании архитектуры
{{#entities}}
{{{.}}} {{{.}}} as {{{.}}}
{{/entities}}
@enduml
90 changes: 87 additions & 3 deletions public/documentation/docs/manual/docs/root.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
imports:
- examples/table.yaml
docs:
# *****************************************
# Руководство по документам
# *****************************************
dochub.docs:
location: DocHub/Руководство/Документы
description: Документы
autor: R.Piontik # Кастомное поле - Автор документа
type: markdown
subjects:
- dochub.front
Expand All @@ -14,6 +18,7 @@ docs:
dochub.markdown:
location: DocHub/Руководство/Документы/Markdown
description: Markdown
autor: R.Piontik
type: markdown
subjects:
- dochub.front
Expand All @@ -23,7 +28,8 @@ docs:
source: markdown.md
dochub.plantuml:
location: DocHub/Руководство/Документы/PlantUML
description: Markdown
description: PlantUML
autor: R.Piontik
type: markdown
subjects:
- dochub.front
Expand All @@ -43,7 +49,8 @@ docs:
source: asyncapi.md
dochub.swagger:
location: DocHub/Руководство/Документы/Swagger
description: Markdown
description: Swagger
autor: R.Piontik
type: markdown
subjects:
- dochub.front
Expand All @@ -53,14 +60,18 @@ docs:
source: swagger.md
dochub.tables:
location: DocHub/Руководство/Документы/Таблицы
description: Markdown
description: Таблицы
autor: R.Piontik
type: markdown
subjects:
- dochub.front
- dochub.front.spa
- dochub.front.spa.blank
- dochub.front.spa.blank.doc
source: tables.md
# *****************************************
# Примеры документов
# *****************************************
dochub.example.pml:
type: PlantUML
subjects:
Expand All @@ -85,3 +96,76 @@ docs:
- dochub.front.spa.blank
- dochub.front.spa.blank.doc
source: examples/asyncapi.yaml
# *****************************************
# Шаблоны
# *****************************************
dochub.templates: # Пример генерации markdown документа по шаблону
location: DocHub/Руководство/Документы/Шаблоны
description: Шаблоны
type: markdown
autor: R.Piontik # Кастомное поле - Автор документа
approvers: # Кастомное поле - список согласующих
- P.Petrov
- S.Sidorov
- N.Nikolaev
source: > # JSONata запрос для формирования параметров шаблона
(
{
"id": $self._id, /* Идентификатор документа */
"autor": $self.autor, /* Автор документа */
"approvers": $self.approvers, /* Согласующие */
"docs": [docs.$spread().{ /* Другие документы автора */
"id": $keys()[0],
"title": *.description,
"autor": *.autor
}][autor=$self.autor]
}
)
subjects:
- dochub.front
- dochub.front.spa
- dochub.front.spa.blank
- dochub.front.spa.blank.doc
template: templates.md # Шаблон документа
dochub.templates.pml: # Пример генерации PlantUML документа по шаблону
type: PlantUML
source: >
(
{
"entities": $distinct([ /* Получаем все использованные сущности при описании архитектуры */
components.*.entity
])
}
)
subjects:
- dochub.front
- dochub.front.spa
- dochub.front.spa.blank
- dochub.front.spa.blank.doc
template: examples/template.puml
dochub.templates.asyncapi: # Пример генерации AsyncAPI документа по шаблону
type: AsyncAPI
source: >
(
$BODY := $mergedeep([components.*.asyncapi]);
{
"content": [$BODY.$spread().{
"field": $keys()[0],
"body": $string($lookup($, $keys()[0]))
}]
}
)
template: examples/asyncapi_template.json
dochub.templates.openapi: # Пример генерации OpenAPI документа по шаблону
type: OpenAPI
source: >
(
$BODY := $mergedeep([components.*.openapi]);
{
"content": [$BODY.$spread().{
"field": $keys()[0],
"body": $string($lookup($, $keys()[0]))
}]
}
)
template: examples/openapi_template.json
2 changes: 1 addition & 1 deletion public/documentation/docs/manual/docs/tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,4 @@ datasets: # Источники данных
Результат:
![Предопределенная таблица](@document/dochub.table.dataset.post)
[Далее](/docs/dochub.datasets)
[Далее](/docs/dochub.templates)
Loading

0 comments on commit e9e556e

Please sign in to comment.