Skip to content

Add KiCad HTTP Library API v2 with volatile field support#1260

Open
Sebbeben wants to merge 1 commit intoPart-DB:masterfrom
Sebbeben:feature/kicad-api-v2
Open

Add KiCad HTTP Library API v2 with volatile field support#1260
Sebbeben wants to merge 1 commit intoPart-DB:masterfrom
Sebbeben:feature/kicad-api-v2

Conversation

@Sebbeben
Copy link
Contributor

@Sebbeben Sebbeben commented Feb 19, 2026

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

File What changed
KiCadApiV2Controller.php New controller at /kicad-api/v2/ with root, categories, category parts, and part detail endpoints
KiCadHelper.php Added int $apiVersion parameter to getKiCADPart(), $volatile parameter to createField()
KiCadApiV2ControllerTest.php Full test coverage: root endpoint, categories, parts, volatile fields, v1 vs v2 comparison, caching, auth

V2 API differences from V1

  • Root endpoint returns links to categories (per v2 spec requirement)
  • Stock field marked as volatile: True (shown in KiCad, not saved to schematic)
  • Storage Location field marked as volatile: True
  • All other fields remain non-volatile (saved to schematic as in v1)

V2 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.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 94.87179% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.58%. Comparing base (78b1d41) to head (dc1754b).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/Controller/KiCadApiV2Controller.php 96.55% 1 Missing ⚠️
src/Services/EDA/KiCadHelper.php 90.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- 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
@Sebbeben Sebbeben force-pushed the feature/kicad-api-v2 branch from 4427ba8 to dc1754b Compare March 7, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant