feat(schema): make schema name configurable (closes #28) #32

Merged
forbes merged 1 commits from feat/configurable-schema-name into main 2026-02-16 19:20:03 +00:00
Owner

Summary

Removes all hardcoded "kindred-rd" schema references from the FreeCAD layer and makes the schema name configurable via FreeCAD preferences, environment variable, or the Settings dialog.

Changes

silo-client submodule (PR: kindred/silo-client#15)

  • Added get_schema_name() to SiloSettings base class (default "kindred-rd", non-abstract)
  • get_schema(), get_schema_form(), get_property_schema() now fall back to settings.get_schema_name() instead of hardcoding
  • get_property_schema() gains optional category query parameter

freecad/silo_commands.py

  • Fixed imports: removed CATEGORY_NAMES, get_category_folder_name, parse_part_number, sanitize_filename (deleted from upstream silo-client v0.2.0)
  • Inlined utilities: _parse_part_number() and _sanitize_filename() defined locally; simplified folder naming to use category code directly
  • Added get_schema_name() to FreeCADSiloSettings — reads SchemaName pref, falls back to SILO_SCHEMA env var, then "kindred-rd"
  • Added _get_schema_name() helper wrapper
  • Settings dialog: new "Schema Name" field between URL and SSL sections, with save logic and Active Values display

freecad/schema_form.py

  • _fetch_properties(): replaced raw urllib.request (10 lines) with self._client.get_property_schema(category=category)
  • _generate_pn_preview(): replaced raw urllib.request (12 lines) with self._client.generate_part_number()
  • _on_create(): replaced "kindred-rd" literal with _get_schema_name()
  • Removed unused urllib imports

Configuration Priority

  1. FreeCAD preference SchemaName (set via Settings dialog)
  2. SILO_SCHEMA environment variable
  3. Default: "kindred-rd"

Verification

  • grep -rn "kindred-rd" freecad/ returns only default values and UI hint text
  • Net: -85 lines, 3 files changed

Closes #28

## Summary Removes all hardcoded `"kindred-rd"` schema references from the FreeCAD layer and makes the schema name configurable via FreeCAD preferences, environment variable, or the Settings dialog. ## Changes ### silo-client submodule (PR: kindred/silo-client#15) - Added `get_schema_name()` to `SiloSettings` base class (default `"kindred-rd"`, non-abstract) - `get_schema()`, `get_schema_form()`, `get_property_schema()` now fall back to `settings.get_schema_name()` instead of hardcoding - `get_property_schema()` gains optional `category` query parameter ### freecad/silo_commands.py - **Fixed imports**: removed `CATEGORY_NAMES`, `get_category_folder_name`, `parse_part_number`, `sanitize_filename` (deleted from upstream silo-client v0.2.0) - **Inlined utilities**: `_parse_part_number()` and `_sanitize_filename()` defined locally; simplified folder naming to use category code directly - **Added `get_schema_name()`** to `FreeCADSiloSettings` — reads `SchemaName` pref, falls back to `SILO_SCHEMA` env var, then `"kindred-rd"` - **Added `_get_schema_name()`** helper wrapper - **Settings dialog**: new "Schema Name" field between URL and SSL sections, with save logic and Active Values display ### freecad/schema_form.py - `_fetch_properties()`: replaced raw `urllib.request` (10 lines) with `self._client.get_property_schema(category=category)` - `_generate_pn_preview()`: replaced raw `urllib.request` (12 lines) with `self._client.generate_part_number()` - `_on_create()`: replaced `"kindred-rd"` literal with `_get_schema_name()` - Removed unused `urllib` imports ## Configuration Priority 1. FreeCAD preference `SchemaName` (set via Settings dialog) 2. `SILO_SCHEMA` environment variable 3. Default: `"kindred-rd"` ## Verification - `grep -rn "kindred-rd" freecad/` returns only default values and UI hint text - Net: -85 lines, 3 files changed Closes #28
forbes added 1 commit 2026-02-16 19:18:28 +00:00
Replace all hardcoded 'kindred-rd' schema references with the new
configurable get_schema_name() setting. Priority: FreeCAD preference
SchemaName > SILO_SCHEMA env var > default 'kindred-rd'.

- Add get_schema_name() to FreeCADSiloSettings and _get_schema_name() helper
- Add Schema Name field to Settings dialog
- Replace raw urllib calls in schema_form.py with SiloClient methods
  (get_property_schema, generate_part_number)
- Inline parse_part_number/sanitize_filename (removed from silo-client)
- Simplify category folder naming to use category code directly
- Update silo-client submodule to origin/main + configurable schema branch

Closes #28
forbes merged commit 7e3127498a into main 2026-02-16 19:20:03 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo-mod#32