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
{{ message }}
Repository navigation
Complex Data Format Linters? Test-Json, Test-yaml, Test-xml, Test-CSV #3613
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues
Sure would be nice to be able to do basic validation of the syntax fussy data formats in code - and even in the console not having to use an editor or website.
I do not mean to imply that powershell do broadbased syntax checking of other things - just these very common data formats that are syntax heavy and that we have to work with a lot.
I believe Test-CSV is impossible - what is formal rules?
Test-Json and Test-xml can be implemented - we have all for that.
Test-yaml only once we receive support for YAML in PowerShell.
Darwin (@DarwinJS) what form do you see this talking? The various import and convert commands already validate that documents are well-formed. Are you talking about schema validation? Better errors?
Bruce Payette (@BrucePay) - I am thinking "dedicated test- CMDLets" (if "test-" is the right verb to use for well-formed validations) to expose this functionality so that:
I can easily discover this functionality.
I can be sure to only receive errors of the format validation (execution of the general CMDLets could be emitting errors for many conditions and I don't know how many different validation errors it might be capable of emitting). Especially important when I as the script author am not the author of the formatted input data.
I can be given the exact position in the data where the error occurs - like I am used to in online linters - this may already be part of the built-in check, but if it is not for any given command, that test-whatever would be diligent in surfacing that information.
If the existing functionality does not do it already, perhaps reporting all errors that can be found, not simply stopping on the first one found.
Although I think a CMDLet is more discoverable, if providing a CMDLet is difficult, perhaps "Convert-ToYaml -validateonly" that just gives a true or the location of the first error.
I haven't wrapped my head around this enough to know if validation errors are all that the "Convert-" CMDLets output? But even if so, I would still say that having dedicated cmdlets would help people understand that better and through broader use feedback might improve the quality of the validation code.
In general it seems like there could be a lot more "Test-" CMDLets across all of powershell.
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 23, 2023
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues
Activity
iSazonov commentedon Apr 21, 2017
I believe Test-CSV is impossible - what is formal rules?
Test-Json and Test-xml can be implemented - we have all for that.
Test-yaml only once we receive support for YAML in PowerShell.
BrucePay commentedon Apr 24, 2017
Darwin (@DarwinJS) what form do you see this talking? The various import and convert commands already validate that documents are well-formed. Are you talking about schema validation? Better errors?
DarwinJS commentedon Apr 24, 2017
Ilya (@iSazonov) - I know that csv does not have a published standard, but tools like CSVEdit (http://csved.sjfrancke.nl/) have been successful at collecting all the "common formats in the wild". However, I'm not really hung on that one - it's these others that I have to deal with much more often.
Bruce Payette (@BrucePay) - I am thinking "dedicated test- CMDLets" (if "test-" is the right verb to use for well-formed validations) to expose this functionality so that:
Although I think a CMDLet is more discoverable, if providing a CMDLet is difficult, perhaps "Convert-ToYaml -validateonly" that just gives a true or the location of the first error.
I haven't wrapped my head around this enough to know if validation errors are all that the "Convert-" CMDLets output? But even if so, I would still say that having dedicated cmdlets would help people understand that better and through broader use feedback might improve the quality of the validation code.
In general it seems like there could be a lot more "Test-" CMDLets across all of powershell.
iSazonov commentedon Oct 31, 2018
Test-Json was added.
jasonchester commentedon Jan 3, 2019
+1 to better handling of CSV files.
While not an official standard there are best practices published and commonly accepted
Test-CSV is certainly possible as there are a number of tools in that space already
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.