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

Validate DAG schema on Monaco #659

Merged
merged 11 commits into from
Feb 1, 2025
Merged

Validate DAG schema on Monaco #659

merged 11 commits into from
Feb 1, 2025

Conversation

vhespanha
Copy link
Contributor

This PR implements DAG schema validation in the Monaco Editor, like suggested here: issue #652

Changes

  1. Schema and Definition Updates

    • Modified the definition struct and JSON schema to accept both array and string representations of the Params field.
    • Implemented type conversion logic to handle both formats.
  2. Monaco Editor Integration

    • Integrated schema validation within the Monaco Editor.
  3. Error Handling

    • By default, the diagnostics from the validation are displayed on browser alerts (from my understanding this is how the repo usually handles Monaco diagnostics).
    • The error messages in alerts are currently raw diagnostic outputs and not user-friendly.

Next steps

The current implementation is functional but i'm considering it a draft since the approach of modifying the JSON schema to handle dual Params representation probably needs review, I'm willing to work on better diagnostics if all is right with the current approach.

@yohamta
Copy link
Collaborator

yohamta commented Aug 12, 2024

Hi @vhespanha, thank you so much for your fantastic work and excellent suggestions! Really appreciate it, I see that this is a hard issue to handle.

Regarding Schema and Definition Updates:
I think adding array format support for parameters is a great idea. Let's definitely move forward with that. Maybe we can add support map as well in the future.

Regarding Monaco Editor Integration:
This looks really promising! I'm excited to see how this improves the experience. Thank you very much!

Regarding Error Handling:
For now, I believe your current approach is suitable.

I did try to test the changes on my end, but it seems the schema validation isn't triggering in my environment. This could potentially be an issue on my side. I'm curious - how is it functioning in your development environment? Could you share some details or screenshots about how you're seeing it work?

Once again, thank you for your hard work!

@vhespanha
Copy link
Contributor Author

Hey!
Here's how it's working on my machine:
image
I get this browser alert whenever the schema is not valid, I'll investigate it further and see if I can reproduce it from a fresh git pull.

@arky
Copy link
Contributor

arky commented Feb 1, 2025

@vhespanha @yohamta Any updates, were you able to replicate and fix the issue?

@yohamta yohamta marked this pull request as ready for review February 1, 2025 09:01
@yohamta yohamta self-requested a review February 1, 2025 09:01
Copy link
Collaborator

@yohamta yohamta left a comment

Choose a reason for hiding this comment

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

LGTM 🚀🚀🚀 Thank you so much for adding autocompletion and error display to the DAG editor. It's now much more useful! Sorry it took me so long to review and merge.

@yohamta yohamta merged commit 38c7969 into dagu-org:main Feb 1, 2025
7 checks passed
Copy link

codecov bot commented Feb 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.55%. Comparing base (8ee81c7) to head (ca0edd8).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #659   +/-   ##
=======================================
  Coverage   55.55%   55.55%           
=======================================
  Files          73       73           
  Lines        7905     7905           
=======================================
  Hits         4392     4392           
  Misses       3134     3134           
  Partials      379      379           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ee81c7...ca0edd8. Read the comment docs.

@yohamta yohamta added this to the v1.16.1 milestone Feb 1, 2025
@arky
Copy link
Contributor

arky commented Feb 1, 2025

Brilliant! Thank you so much for your contribution @vhespanha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants