Make schema name configurable — remove hardcoded "kindred-rd" #28

Closed
opened 2026-02-16 16:46:12 +00:00 by forbes · 0 comments
Owner

Summary

The schema name "kindred-rd" is hardcoded in three places within schema_form.py, locking the addon to a single schema and preventing multi-schema deployments.

Hardcoded Locations

File Line Usage
freecad/schema_form.py ~273 Schema properties endpoint: f"{api_url}/schemas/kindred-rd/properties?category={cat}"
freecad/schema_form.py ~294 Part number generation payload: {"schema": "kindred-rd", ...}
freecad/schema_form.py ~578 create_item() call passes "kindred-rd" as the schema argument

Impact

  • Any deployment using a different schema name (e.g. "acme-eng", "widgets-prod") cannot use the New Item form at all.
  • The silo-client submodule is designed to be generic and schema-agnostic — this hardcoding in the FreeCAD layer breaks that design intent.

Proposed Solution

  1. Add a Schema preference to FreeCADSiloSettings under User parameter:BaseApp/Preferences/Mod/KindredSilo, with "kindred-rd" as the default value.
  2. Expose the setting in the Silo Settings dialog (Silo_Settings command).
  3. Replace all three hardcoded occurrences in schema_form.py with _fc_settings.get_schema() (or equivalent).
  4. Optionally support a SILO_SCHEMA environment variable as fallback, consistent with the existing SILO_API_URL / SILO_API_TOKEN pattern.
  5. Consider whether the schema list should be fetched from the server (e.g. GET /api/schemas) for a dropdown rather than requiring manual entry.

Acceptance Criteria

  • No literal "kindred-rd" string remains in the codebase
  • Schema name is configurable via FreeCAD preferences UI
  • Default value preserves backwards compatibility ("kindred-rd")
  • Environment variable override works as fallback
## Summary The schema name `"kindred-rd"` is hardcoded in three places within `schema_form.py`, locking the addon to a single schema and preventing multi-schema deployments. ## Hardcoded Locations | File | Line | Usage | |---|---|---| | `freecad/schema_form.py` | ~273 | Schema properties endpoint: `f"{api_url}/schemas/kindred-rd/properties?category={cat}"` | | `freecad/schema_form.py` | ~294 | Part number generation payload: `{"schema": "kindred-rd", ...}` | | `freecad/schema_form.py` | ~578 | `create_item()` call passes `"kindred-rd"` as the schema argument | ## Impact - Any deployment using a different schema name (e.g. `"acme-eng"`, `"widgets-prod"`) cannot use the New Item form at all. - The `silo-client` submodule is designed to be generic and schema-agnostic — this hardcoding in the FreeCAD layer breaks that design intent. ## Proposed Solution 1. Add a `Schema` preference to `FreeCADSiloSettings` under `User parameter:BaseApp/Preferences/Mod/KindredSilo`, with `"kindred-rd"` as the default value. 2. Expose the setting in the Silo Settings dialog (`Silo_Settings` command). 3. Replace all three hardcoded occurrences in `schema_form.py` with `_fc_settings.get_schema()` (or equivalent). 4. Optionally support a `SILO_SCHEMA` environment variable as fallback, consistent with the existing `SILO_API_URL` / `SILO_API_TOKEN` pattern. 5. Consider whether the schema list should be fetched from the server (e.g. `GET /api/schemas`) for a dropdown rather than requiring manual entry. ## Acceptance Criteria - [ ] No literal `"kindred-rd"` string remains in the codebase - [ ] Schema name is configurable via FreeCAD preferences UI - [ ] Default value preserves backwards compatibility (`"kindred-rd"`) - [ ] Environment variable override works as fallback
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo-mod#28