Add KiCad HTTP Library API v2 with volatile field support#1260
Add KiCad HTTP Library API v2 with volatile field support#1260Sebbeben wants to merge 1 commit intoPart-DB:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1260 +/- ##
============================================
+ Coverage 55.41% 55.58% +0.16%
- Complexity 8268 8281 +13
============================================
Files 610 612 +2
Lines 26519 26590 +71
============================================
+ Hits 14696 14780 +84
+ Misses 11823 11810 -13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c1cb018 to
4427ba8
Compare
- New KiCadApiV2Controller at /kicad-api/v2/ endpoints - Root endpoint returns links to categories endpoint (per v2 spec) - Volatile fields: Stock and Storage Location are shown in KiCad but NOT saved to schematic (v2 spec feature) - int $apiVersion parameter on KiCadHelper::getKiCADPart() with version validation (supports v1 and v2) - createField() supports $volatile parameter for v2 fields - Full test coverage for v2 controller endpoints v2 spec (draft): https://gitlab.com/RosyDev/kicad-dev-docs/-/blob/http-lib-v2/content/apis-and-binding/http-libraries/http-lib-v2-00.adoc
4427ba8 to
dc1754b
Compare
|
Are the new HTTP library things actual part of any KiCad release? I could not find anything about it for the upcoming KiCad 10. In the linked documentation it seems that v2 was renamed to v1.1, and also includes other things than just a volatile property field (like timestamping) |
|
Sorry for the late reply! I got a bit ahead of myself with this one — I assumed that since the v2 spec documentation existed, it would ship with KiCad 10, but that doesn't appear to be the case. You're right on both points. The spec was renamed from v2 to v1.1, and it's much more than just volatile fields. After going through the full spec, v1.1 is primarily about timestamp-based incremental caching — the update endpoint, restructured parts/categories responses with timestamps and pagination, field type declarations (essential/detail/hidden), shorthand keys, etc. The volatile fields part is actually commented out throughout the spec and explicitly marked as "not currently supported by KiCad." This PR only addressed the volatile fields, which is ironically the one part that isn't even active in the spec. I'd suggest closing this for now and revisiting once v1.1 actually lands in a KiCad release — at which point a proper implementation covering the full spec (especially the caching/timestamping) would make much more sense. |
Summary
Adds KiCad HTTP Library API v2 support with volatile field support, split out from #1241 as discussed.
The v2 spec introduces volatile fields — fields that are shown in KiCad's UI but NOT saved to the schematic. This is ideal for dynamic data like stock quantity and storage location.
Changes
KiCadApiV2Controller.php/kicad-api/v2/with root, categories, category parts, and part detail endpointsKiCadHelper.phpint $apiVersionparameter togetKiCADPart(),$volatileparameter tocreateField()KiCadApiV2ControllerTest.phpV2 API differences from V1
volatile: True(shown in KiCad, not saved to schematic)volatile: TrueV2 spec reference
Note
This PR is intentionally minimal — only the v2-specific additions. The underlying KiCad improvements (batch EDA editing, parameter export, populate command, etc.) were merged in #1241. This can be merged once the v2 spec is finalized, or kept as a draft until then.