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
Support validating JSON piped to stdin #251
Comments
I started to take a look at how hard this would be last week and didn't get to writing a reply; sorry about that. That would make for usage as follows:
I think it's a bit messier than you might expect to get this into the codebase. Ideally, from a maintenance standpoint, the instance files would be parsed using I may also start working on this myself at some point. I think it would be a good feature. |
I've started working on this in a fork. (In fact, almost done!) I didn't read your comment before I began working, but coincidentally, I happened to do it as you suggested, using However, a simpler implementation would be to handle the list of file names, adding |
That's great! Many, many thanks for looking into this! I was doing some tinkering on this front as well, after the other ticket, so I just committed what I had to be able to put it in a branch to share -- in case it's useful: https://github.com/python-jsonschema/check-jsonschema/compare/support-stdin
I would prefer to use So even though it's more work to accommodate it today, I think it will be more maintainable in the long term. If the behavior is enough trouble that it's the difference between you being able to submit a PR or not though, I'd rather have the PR than |
Works through steps of argument parsing and accessing open files. TODO: Update schema parser arguments.
I decided to knock this out because I thought the branch I had was most of the way there other than having to pull in a bunch of test fixes. I considered holding off a bit longer -- I am glad and thankful for the interest in contributing a change, and I hope this experience isn't discouraging! -- but concluded that I have the time and attention for this now and I shouldn't waste the opportunity. This was handled in #332 . I'll pull together a final changelog and then expect this in a release! |
Oh, you went ahead and completed it? I didn't check the issue here before I continued working on it. 😆 Well, I'll see what you ended up with. I compared my branch to yours. They were very similar, but I had an extra feature that I think would be very helpful. I also had some questions about why some path function arguments were declared as path objects or string in a number of places when the path values seemed to always be string. |
Sorry about that! I had the work mostly done except for some test fixes, and then I put it on ice for a few days to give time and space for a contribution. But it was an awkward situation (one branch from the maintainer, one from a new contributor, both on the same feature) and I made the call that spending another hour and releasing it was best. Maybe a mistake, but these things are hard to judge.
I'd be more than happy to take a separate feature request or PR!
The simplest answer is that there were some test cases (not sure if any still exist) which pass paths built from pytest fixtures. But also I happen to think that So in inclined to keep things this way, although I am always open to having my mind changed. |
I want to do something like:
To be able to use
check-jsonschema
to validate JSON output from programs. Often one can add schema validation to the program itself, but in many cases, this isAre you open to a pull request with this feature?
The text was updated successfully, but these errors were encountered: