From 1fa4479c10c37da1164eecb7d791b05351da3e2a Mon Sep 17 00:00:00 2001 From: Ludovic Dussart Date: Fri, 12 Mar 2021 18:25:08 +0100 Subject: [PATCH] feat(bindings): display bindings on channel, operation and message level Close #25 --- partials/message.html | 5 +++- partials/operation.html | 3 ++ partials/operations.html | 2 ++ partials/protocols.html | 60 ++++++++++++++++++++++++++++++++++++++++ partials/servers.html | 11 ++------ 5 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 partials/protocols.html diff --git a/partials/message.html b/partials/message.html index 301b057d9..84dde4d89 100644 --- a/partials/message.html +++ b/partials/message.html @@ -1,5 +1,6 @@ {% from "./schema.html" import schema %} {% from "./tags.html" import tags %} +{% from "./protocols.html" import bindings %} {% macro message(msg, showIndex=false, index=0, open=false) %} @@ -23,7 +24,6 @@ {% if correlationId %}
Correlation ID{{correlationId.location()}} -
{% if correlationId.hasDescription() %}
{{correlationId.description() | markdown2html | safe }}
@@ -40,6 +40,9 @@ {{ schema(msg.headers(), 'Headers', open=open) }}
{% endif %} + + {{ bindings("Message", msg, odd=true) }} + {% endmacro %} diff --git a/partials/operation.html b/partials/operation.html index cb303303c..f530b99c7 100644 --- a/partials/operation.html +++ b/partials/operation.html @@ -3,6 +3,7 @@ {% from "./message.html" import message %} {% from "./example.html" import example %} {% from "./schema-prop.html" import schemaProp %} +{% from "./protocols.html" import bindings %} {% macro operation(operation, operationType, channelName, channel) %} @@ -26,6 +27,7 @@

{{operation.summary()}}

{{ operation.description() | markdown2html | safe }}
+ {{ bindings("Channel", channel) }} {% if channel.parameters() | length %} @@ -50,6 +52,7 @@

{% endif %} + {{ bindings("Operation", channel) }} {% if operation.hasMultipleMessages() %}

Accepts one of the following messages:

diff --git a/partials/operations.html b/partials/operations.html index 6938c76f0..73c94a76f 100644 --- a/partials/operations.html +++ b/partials/operations.html @@ -1,4 +1,6 @@ {% from "./operation.html" import operation %} +{% from "./protocols.html" import bindings %} +

Operations

diff --git a/partials/protocols.html b/partials/protocols.html new file mode 100644 index 000000000..b16d75d3b --- /dev/null +++ b/partials/protocols.html @@ -0,0 +1,60 @@ +{% macro displayProtocol(protocol, protocolVersion) %} + {% if protocolVersion %} + {{ protocol }} + {{ protocolVersion }} + {% else %} + {{ protocol }} + {% endif %} +{% endmacro %} + + +{% macro bindings(eltName, elt, odd=false) %} + + {% if elt.hasBindings() %} + {% for protocol in elt.bindingProtocols() %} +
+ {{eltName}} specific information: + {{ displayProtocol(protocol) }} +
+ {% for bindingName, bindingValue in elt.binding(protocol) %} +
+ {% if bindingValue | isObject %} +
+
+
+ {{ bindingName }} + + + +
+
+
+
+
{{ bindingValue | dump(2) }}
+
+
+
+ {% else %} +
{{ bindingName }}: {{ bindingValue }}
+ {% endif %} +
+ {% endfor %} + {% endfor %} + {% endif %} + +{% endmacro %} diff --git a/partials/servers.html b/partials/servers.html index b75554557..d274cd24a 100644 --- a/partials/servers.html +++ b/partials/servers.html @@ -1,4 +1,6 @@ {% from "./sliced-string.html" import slicedString %} +{% from "./protocols.html" import displayProtocol %} +
@@ -11,14 +13,7 @@

Servers

{{ slicedString(server.url()) }} - {% if server.protocolVersion() %} - {{server.protocol()}} - {{server.protocolVersion()}} - {% else %} - {{server.protocol()}} - {% endif %} + {{ displayProtocol(server.protocol(), server.protocolVersion()) }}
{{ server.description() | markdown2html | safe }}