Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix templates for safe rendering of comments, pipeline & property descriptions #2467

Merged
merged 7 commits into from
Feb 16, 2022

Conversation

kiersten-stokes
Copy link
Member

@kiersten-stokes kiersten-stokes commented Feb 9, 2022

Fixes #2461
This also fixes a recent bug (no corresponding issue currently open) where certain Airflow operators were causing an error popup with JsonDecodeError due to unescaped characters in property descriptions.

What changes were proposed in this pull request?

  • Converts pipeline descriptions and node comments (in the airflow DAG template) to multi-line strings (""") using the jinja replace filter and escapes any other existing instances of """ to avoid black formatting errors after DAG render.

DAG:
Screen Shot 2022-02-10 at 12 11 04 PM

Airflow GUI:
Screen Shot 2022-02-10 at 12 07 20 PM

  • Converts property descriptions (in the canvas properties template) to JSON-safe strings using jinja's tojson|safe filter. This allows un-escaped characters to be caught before descriptions are converted to JSON in the properties API request.

Python operator file (source):
Screen Shot 2022-02-10 at 12 08 54 PM

Properties panel:
Screen Shot 2022-02-10 at 12 12 53 PM

How was this pull request tested?

A case has been added to an existing test for each scenario above.

This PR will remain in draft form until more manual testing occurs.

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

@elyra-bot
Copy link

elyra-bot bot commented Feb 9, 2022

Thanks for making a pull request to Elyra!

To try out this branch on binder, follow this link: Binder

@kiersten-stokes kiersten-stokes added this to the 3.7.0 milestone Feb 9, 2022
@kiersten-stokes kiersten-stokes marked this pull request as ready for review February 10, 2022 22:31
Copy link
Member

@ptitzler ptitzler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following comment cannot be handled by the proposed solution. This comment

line feeds
line feeds
can you handle """
yes you can!

yields

Cannot parse: 59:0: op_b12bffe0_8734_4719_bed5_a4e11668f50e.image_pull_policy = 'IfNotPresent'

Copy link
Member

@ptitzler ptitzler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lresende
Copy link
Member

Could you make the title string to fit the commit title guidelines

@kiersten-stokes kiersten-stokes changed the title Fix jinja templates to render component and property descriptions as JSON-safe strings Fix templates for safe rendering of node comments & pipeline/component property descriptions Feb 16, 2022
@kiersten-stokes kiersten-stokes changed the title Fix templates for safe rendering of node comments & pipeline/component property descriptions Fix templates for safe rendering of comments, pipeline & property descriptions Feb 16, 2022
@akchinSTC akchinSTC merged commit 989fc10 into elyra-ai:master Feb 16, 2022
@ptitzler ptitzler added the kind:bug Something isn't working label Feb 18, 2022
@kiersten-stokes kiersten-stokes deleted the fix-templates branch April 1, 2022 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pipeline processing fails for installation validation pipeline
4 participants