Fix validation for SMB share paths that are dirs
This commit fixes over-strict validation of ZFS properties for
child datasets of SMB shares. If the dataset mountpoint isn't a
child path of the share path then we don't need to check its
properties.
NAS-XXXXX: Fix flake8 issues in WebShare configuration
- Fix line length issues in API schema docstrings
- Remove trailing whitespace and blank line issues
- Improve code formatting for better readability
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply at anthropic.com>
NAS-XXXXX: Add PAM service name and allowed groups to WebShare config
- Add pam_service_name field (read-only, hardcoded to 'webshare')
- Add allowed_groups field with API support and validation
- Update database model with new srv_pam_service_name and srv_allowed_groups columns
- Add validation to ensure groups exist on the system
- Update configuration file generation to include new fields
- Set default allowed_groups to ['webshare'] when empty
- Update alembic migration to include new fields in initial setup
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply at anthropic.com>
Remove webshare user property from middleware
- Remove bsdusr_webshare column from user model
- Update alembic migration to exclude webshare user column
- Remove webshare authentication logic from auth service
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply at anthropic.com>
Fix app creation with empty values by populating defaults
When creating apps with empty values {}, the schema validation was using
exclude_unset=True which prevented defaults from being populated. This
caused template rendering to fail when accessing fields like run_as.user.
Changed construct_schema to use exclude_unset=False so defaults are properly
populated for fields not provided by the user.
- Updated validate_model call to exclude_unset=False in construct_schema
- Added test to verify defaults are populated with empty input
- Updated test_normalize_and_validate to use actual validation logic
Fix nested show_if inheritance for dict fields
When a parent dict field is hidden by a show_if condition, its required
nested fields should not trigger validation errors. This fix propagates
the visibility state from parent dict fields to their children during
Pydantic model generation.
The implementation:
- Adds parent_hidden parameter to generate_pydantic_model to track visibility
- Evaluates show_if conditions for dict fields and propagates hidden state
- Marks all fields as NotRequired when their parent dict is hidden
- Preserves existing show_if behavior for non-nested cases
This resolves the issue where required fields inside hidden dict
structures (e.g., storage.data.host_path_config.path) would still
cause validation errors even when their parent was hidden by show_if.
Revert "Fix dict/list required/non-required issue"
This reverts commit 2217062dd210d19a21d7011f4b518098addba5f3.
The original behavior where non-required lists and dicts automatically get
empty defaults ([] and {}) was the intended behavior for backward compatibility
with existing app configurations.
This commit restores:
- default_factory assignment for nested dicts in process_schema_field
- default_factory set to list/dict for non-required lists/dicts in create_field_info_from_schema
- Test expectations that non-required lists/dicts get empty defaults
The behavior ensures that:
- Non-required lists without explicit defaults get []
- Non-required dicts without explicit defaults get {}
- Nested dicts with default values on all subfields get instantiated with those defaults
Add string length validation for hostpath schema types
- Add create_length_validated_hostpath function to apply min/max length validation before path conversion
- Update schema construction to use length-validated hostpath when constraints are specified
- Add comprehensive tests for path and hostpath types with length constraints
- Fix test expectations to properly validate empty strings against length constraints
- Update test assertions for path type to expect 'items' in error messages
- Fix code quality issues (trailing whitespace, blank lines)
This ensures hostpath fields properly validate string length before converting to Path objects,
preventing TypeError when length constraints are applied.
Fix test_normalize_and_validate and clean up flake8 issues
- Fixed test_normalize_and_validate by properly mocking validate_values
to return a mutable dictionary instead of a Dict schema object
- Removed unused pytest import from test_nested_show_if.py
- Fixed whitespace issues (W293, W291, W292) in both modified files
- All tests now pass successfully
Fix nested show_if evaluation with defaults
When evaluating show_if conditions, the code now properly builds an
evaluation context that includes default values from sibling fields.
This fixes the issue where fields with show_if conditions inside
hidden parent dicts would still cause validation errors.
The fix addresses the actual-budget app installation issue where
the path field was required even though its parent host_path_config
was hidden due to type='ix_volume' (default).
Changes:
- Build eval_context with both provided values and defaults
- Use eval_context for show_if evaluation instead of raw new_values
- Added test case for nested show_if with field-level conditions
- Fixed flake8 whitespace issues
Fix NotRequired handling and improve default value population
- Fix remove_not_required() to handle string representations of NotRequired objects
that appear when using dynamic Pydantic models
- Add comprehensive test coverage for default values and NotRequired handling
- Ensure empty dicts/lists are populated for non-required fields without defaults
- Allow explicitly provided values to override show_if conditions
- Update test expectations to match correct behavior where:
- Non-required dict fields get empty dict defaults
- Non-required list fields get empty list defaults
- Explicitly provided values are included even when show_if=false
- Fields with defaults are populated when not provided by user
This ensures consistent behavior for app schema validation and proper
handling of optional fields across all schema types.
Fix nested validation error paths to exclude 'values' prefix
Previously, validation errors for nested fields were prefixed with 'values.'
(e.g., 'values.database.host' instead of just 'database.host'). This made
error messages less clear and inconsistent with field naming.
Changes:
- Modified construct_schema() to use verrors.extend() instead of
verrors.add_child('values', e) to avoid adding the prefix
- Added comprehensive tests for nested validation error paths
- Updated existing tests to expect clean paths without prefix
This improves error reporting clarity for deeply nested app configurations.
Fix tests for schema construction utilities
- Update test_field_with_ref_metadata and test_field_with_dollar_ref to remove
$ref metadata assertions after recent changes
- Add comprehensive tests for all field types through construct_schema:
- test_construct_schema_with_ipaddr for IPv4/IPv6 validation
- test_construct_schema_with_uri for URI validation and normalization
- test_construct_schema_with_hostpath for path validation
- test_construct_schema_with_path for absolute path validation
- test_construct_schema_with_all_field_types for comprehensive coverage
- Ensure tests verify both model field types and data serialization
- Fix flake8 whitespace issues
All 78 tests now pass successfully.