bergerb / bergerb/DailyOneRosterFile

Add OneRoster Validator Feature

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Overview
Add on-demand validation of generated OneRoster 1.1 ZIP files to ensure structural integrity and provide validation results via API.

## Background
The NemesisApp project has a `ValidateOneRosterFileService` that validates uploaded OneRoster files before import. This feature would bring similar validation capabilities to DailyOneRosterFile, allowing users to verify the integrity of generated files.

## Requirements
1. **Validation Checks** (4 checks from NemesisApp):
- ZIP file count validation (minimum 8 files)
- Required files present validation (all 8 mandatory CSVs)
- CSV header count validation (verify column counts match OneRoster 1.1 spec)
- Invalid character warnings (scan for known invalid characters like "???")

2. **API Endpoints**:
- `GET /api/files/validate?variant={small|large}` - Validate a stored file
- `GET /api/files/validation-result?variant={small|large}` - Get validation status

3. **Implementation Details**:
- On-demand validation (not automatic after generation)
- Stateless validation (no database required)
- Return JSON with `isValid`, `errors`, and `warnings`
- Reuse existing `IStorageService` to access files

## Technical Design
See detailed design doc: `docs/superpowers/specs/2026-07-14-oneroster-validator-design.md`

### New Components
- `IOneRosterValidator` interface
- `OneRosterValidator` service implementation
- `ValidationResult` model
- API endpoints in `FilesController`

### Validation Constants (from NemesisApp)
```csharp
// Required files and their expected header counts
new { FileName = "academicsessions.csv", HeaderCount = 9 },
new { FileName = "classes.csv", HeaderCount = 14 },
new { FileName = "courses.csv", HeaderCount = 10 },
new { FileName = "demographics.csv", HeaderCount = 16 },
new { FileName = "enrollments.csv", HeaderCount = 11 },
new { FileName = "manifest.csv", HeaderCount = 2 },
new { FileName = "orgs.csv", HeaderCount = 7 },
new { FileName = "users.csv", HeaderCount = 18 }
```

## Testing
- Unit tests for each validation check
- Integration tests for API endpoints
- Test with valid and invalid ZIP files

## Success Criteria
- Validation endpoint returns accurate results
- All 4 validation checks work correctly
- Proper HTTP status codes (200, 404, 500)
- No impact on existing functionality
- Unit test coverage > 90% for validator logic

## Implementation Steps
1. Create `IOneRosterValidator` interface
2. Create `ValidationResult` model
3. Implement `OneRosterValidator` service
4. Add validation endpoints to `FilesController`
5. Register services in DI container
6. Write unit tests
7. Update documentation

## Related Issues
- Reference: NemesisApp `ValidateOneRosterFileService`
- Design doc: `docs/superpowers/specs/2026-07-14-oneroster-validator-design.md`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading docs/superpowers/specs/2026-07-14-oneroster-validator-design.md and inspect FilesController and the existing IStorageService. Implement the validator and API behavior described in the issue, then add unit tests for each of the four checks and integration tests for both endpoints. Done means valid and invalid ZIP files return the specified JSON results and HTTP statuses, with validator coverage above 90%.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.