-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
Docs suggestion: pydantic models for borg's JSON output #8338
Comments
Interesting idea, but I'ld rather would like to have them in the code and also have unit tests that they actually work. So we'll know when something breaks. I don't use pedantic myself, but I'ld review a PR for such an addition. |
Are you saying you'd prefer them to be importable from borg's code? I'm asking because the docs say that the internals aren't stable and that users should use the CLI. Or do you just mean that they should be in the code for tests, and automatically copied in the docs too? |
Yeah, internal apis are not stable. Guess not even the JSON is not fully stable, there might be quite some changes coming in borg2... But we could have the models in the code and tests that they actually work for the current version. |
It might be a good reason to introduce private naming and public naming |
I'd suggest having a very very small public stable API, and the models could be in a module per version? |
I opened a pull request there; I can add more tests if you validate those. I'm on macOS and don't use homebrew so installing borg here is kind of a mess (missing pkg-config). I will try later. |
Have you checked borgbackup docs, FAQ, and open GitHub issues?
Yes
Is this a BUG / ISSUE report or a QUESTION?
It's an ISSUE (suggestion for docs improvement actually).
I don't think system info is needed.
Your borg version (borg -V).
1.4.0.
Describe the problem you're observing.
I wrote a small borg automation project for myself. Parsing borg's JSON output with pydantic was a bit of a pain because I had to write models for this by hand.
I suggest adding these Pydantic v2 models to the same docs, to make it easier to write frontends:
I think they are correct, I can parse all of borg's outputs in my runs.
Let me know if this is out of scope here and I should suggest it somewhere else :)
The text was updated successfully, but these errors were encountered: