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 command #2410

Closed
cllns opened this issue Mar 5, 2025 · 3 comments · Fixed by #2415
Closed

Validate command #2410

cllns opened this issue Mar 5, 2025 · 3 comments · Fixed by #2415
Labels
good first issue Good for newcomers

Comments

@cllns
Copy link

cllns commented Mar 5, 2025

Hi there!

I'm working on using D2 in my codebase, and in my tests I'd like to just parse the file to validate that the d2 code generated is valid, without actually generating a file.

I ended up implementing this as d2 graph.d2 /dev/null, which works but I think a CLI option would be better since many people don't know about /dev/null

@cyborg-ts cyborg-ts added this to D2 Mar 5, 2025
@alixander
Copy link
Collaborator

alixander commented Mar 5, 2025

Ah that's a good idea.

I think instead of a flag, this could just serve as its own command. d2 validate input.d2.

@alixander alixander added the good first issue Good for newcomers label Mar 5, 2025
@cllns cllns changed the title --validate CLI arg Validate command Mar 5, 2025
@melsonic
Copy link
Contributor

melsonic commented Mar 9, 2025

Hey @alixander, I am working on this one & I have a few questions.

  1. Should this command support multiple files streamlined together or a single file.
  2. Do I need to print something if the file is valid? like "inputPath is valid"

@alixander
Copy link
Collaborator

@melsonic Awesome!

  1. I think just 1 file is fine.
  2. It can print out the errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants