olchas commented on a change in pull request #11061: URL: https://github.com/apache/airflow/pull/11061#discussion_r492584078
########## File path: docs/howto/custom-operator.rst ########## @@ -200,6 +200,35 @@ with actual value. Note that Jinja substitutes the operator attributes and not t In the example, the ``template_fields`` should be ``['guest_name']`` and not ``['name']`` +Additionally you may provide ``template_fields_renderers`` dictionary which defines in what style the value +from template field renders in Web UI. For example: + +.. code-block:: python + + class MyRequestOperator(BaseOperator): + template_fields = ['request_body'] + template_fields_renderers = {'request_body': 'json'} + + @apply_defaults + def __init__( + self, + request_body: str, + **kwargs) -> None: + super().__init__(**kwargs) + self.request_body = name + +Currently available lexers: + + - bash + - doc + - json + - md + - py + - rst + - sql + - yaml + +If you will use non existing lexer the value of the template filed be rendered as pretty printed object. Review comment: ```suggestion If you use a non existing lexer then the value of the template field will be rendered as a pretty printed object. ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org