You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Postee 1.x has only one type of input - scan result and there was a procedure that build payload using predefined json structure and calls to methods above.
Postee 2.x has support for audit events and and input json is no more predefined and existing procedure won’t work correctly. So there is a problem how to add formatting to messages which are sent to integrations.
Possible solutions
REGO rules
REGO rules allow to filter a payload. But we need a way to convert data from JSON to some format which Postee will be able render to Plugin formats (html, markdown, Atlassian DF etc.).
Special JSON structure
JSON nodes include enough information to call layout methods like:
{
type : "p",text : "Image scanned",children: [...]
}
Simple JSON rendering
Kind of simple implementation when JSON property key is rendered as bold text and value as simple text and both key and value are on same line like: Image: alpine
JSON array could be rendered as tables where properties are columns and every item is row
Go Templates
Using Go Templates will allow to filter payloads and discard unnecessary data. But Go template will render a string, what will we do with table?
Any templating engine producing XML
json is pre processed and applied to template and result is something like
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Problem
Currently every integration implements set of methods to apply formatting to message. List of formatting options:
Postee 1.x has only one type of input - scan result and there was a procedure that build payload using predefined json structure and calls to methods above.
Postee 2.x has support for audit events and and input json is no more predefined and existing procedure won’t work correctly. So there is a problem how to add formatting to messages which are sent to integrations.
Possible solutions
REGO rules
REGO rules allow to filter a payload. But we need a way to convert data from JSON to some format which Postee will be able render to Plugin formats (html, markdown, Atlassian DF etc.).
Special JSON structure
JSON nodes include enough information to call layout methods like:
Simple JSON rendering
Kind of simple implementation when JSON property key is rendered as bold text and value as simple text and both key and value are on same line like:
Image: alpine
JSON array could be rendered as tables where properties are columns and every item is row
Go Templates
Using Go Templates will allow to filter payloads and discard unnecessary data. But Go template will render a string, what will we do with table?
Any templating engine producing XML
json is pre processed and applied to template and result is something like
So layout methods can be called based on tag name and attributes.
Written by @AndreyLevchenko
Beta Was this translation helpful? Give feedback.
All reactions