|
5 | 5 | [](https://ajv.js.org/) |
6 | 6 | [](https://ui.shadcn.com/) |
7 | 7 |
|
8 | | -A web-based tool to validate CSV data against JSON schemas directly in your browser. Edit your data on the fly and ensure compliance with predefined or custom structures. |
| 8 | +A modern web-based tool to validate CSV data against JSON schemas, edit CSVs, and ensure compliance with custom or predefined structures. Built with Next.js 15+, TypeScript, and a robust UI/UX. |
9 | 9 |
|
10 | 10 | --- |
11 | 11 |
|
12 | 12 | ## ✨ Features |
13 | 13 |
|
14 | | -* **CSV Upload:** Easily upload your CSV files via drag-and-drop or file selection. |
15 | | -* **Schema Selection:** Choose from a list of predefined JSON schemas tailored for specific data types. |
16 | | -* **Custom Schema Upload:** Validate against your own JSON schema by uploading it. |
17 | | -* **In-Browser Validation:** Performs validation locally using Web Workers for a smooth UI experience. |
18 | | -* **Detailed Results:** View a clear list of validation errors and warnings, sorted with errors first. |
19 | | - * **Specific Value Highlighting:** Error messages pinpoint the exact value that caused the issue. |
20 | | -* **Live CSV Editing:** Modify your CSV data directly within the application using a code editor interface. |
21 | | -* **Save Modified CSV:** Download the edited CSV data back to your local machine. |
22 | | -* **Auto Re-validation:** Automatically re-validates the CSV data after saving changes. |
| 14 | +- **CSV Upload & Editing:** Upload, edit, and validate CSV files in-browser with a code editor interface. |
| 15 | +- **Schema Selection & Upload:** Choose from predefined JSON schemas or upload your own custom schema. |
| 16 | +- **Live Validation:** Real-time validation using Ajv, with errors and warnings shown per row and value. |
| 17 | +- **Detailed Results:** Errors and warnings are clearly displayed, with row numbers and schema paths. |
| 18 | +- **Save & Download:** Download your edited CSV at any time. |
| 19 | +- **Auto Re-validation:** CSV is re-validated after every save or edit. |
| 20 | +- **Human-Readable Schema Docs:** View a Markdown-rendered, human-friendly version of the selected schema. |
| 21 | +- **Responsive UI:** Panels resize and animate smoothly; results always visible. |
| 22 | +- **Dark Mode:** Full support for light/dark themes, including logo adaptation. |
| 23 | +- **E2E Testing:** Playwright-based end-to-end tests for reliability. |
| 24 | +- **CI/CD:** Automated lint, test, build, and deploy via GitHub Actions. |
23 | 25 |
|
24 | 26 | --- |
25 | 27 |
|
26 | 28 | ## 🚀 Getting Started |
27 | 29 |
|
28 | 30 | ### Prerequisites |
29 | | - |
30 | | -* Node.js (v18 or later recommended) |
31 | | -* pnpm (or npm/yarn) |
| 31 | +- Node.js (v18 or later recommended) |
| 32 | +- pnpm (or npm/yarn) |
32 | 33 |
|
33 | 34 | ### Installation & Running Locally |
34 | 35 |
|
35 | | -1. **Clone the repository:** |
36 | | - ```bash |
37 | | - git clone https://github.com/FabienDostieIT/CSV_Data_Validator.git |
38 | | - cd CSV_Data_Validator |
39 | | - ``` |
| 36 | +```bash |
| 37 | +# Clone the repository |
| 38 | +git clone https://github.com/FabienDostieIT/CSV_Data_Validator.git |
| 39 | +cd CSV_Data_Validator |
40 | 40 |
|
41 | | -2. **Install dependencies:** |
42 | | - ```bash |
43 | | - pnpm install |
44 | | - # or npm install / yarn install |
45 | | - ``` |
| 41 | +# Install dependencies |
| 42 | +pnpm install |
| 43 | +# or npm install / yarn install |
46 | 44 |
|
47 | | -3. **Run the development server:** |
48 | | - ```bash |
49 | | - pnpm dev |
50 | | - # or npm run dev / yarn dev |
51 | | - ``` |
| 45 | +# Run the development server |
| 46 | +pnpm dev |
| 47 | +# or npm run dev / yarn dev |
52 | 48 |
|
53 | | -4. Open [http://localhost:3000](http://localhost:3000) in your browser. |
| 49 | +# Open http://localhost:3000 in your browser |
| 50 | +``` |
54 | 51 |
|
55 | 52 | --- |
56 | 53 |
|
57 | | -## 🛠️ How to Use |
58 | | - |
59 | | -### 1. Upload CSV File |
60 | | - |
61 | | -* Drag and drop your CSV file onto the designated area. |
62 | | -* Alternatively, click the upload area to open a file selection dialog. |
63 | | -* The raw CSV content will be displayed in the editor pane. |
64 | | - |
65 | | -  |
66 | | - |
67 | | -### 2. Select or Upload Schema |
68 | | - |
69 | | -* **Predefined Schema:** Choose a schema from the dropdown list (e.g., `productSchema`, `userSchema`). The validation will use this structure. |
70 | | -* **Custom Schema:** |
71 | | - * Click the "Upload Custom Schema" button. |
72 | | - * Select your JSON schema file (`.json`). |
73 | | - * The application will use your uploaded schema for validation. |
74 | | - |
75 | | -  |
76 | | - |
77 | | -### 3. Validate Data |
78 | | - |
79 | | -* Click the "Validate CSV" button. |
80 | | -* The validation process runs in the background. |
81 | | -* A loading indicator will show while processing. |
82 | | - |
83 | | -### 4. Review Results |
84 | | - |
85 | | -* Once validation is complete, the "Validation Results" section will appear below the editor. |
86 | | -* Results are categorized into **Errors** and **Warnings**. |
87 | | -* Errors are listed first, followed by warnings. |
88 | | -* Each result shows: |
89 | | - * Row Number (in the original CSV) |
90 | | - * Error/Warning Message (including the specific problematic value) |
91 | | - * Schema Path (`instancePath`) indicating the location of the issue within the data structure. |
92 | | -* Counts for total errors and warnings are displayed. |
93 | | - |
94 | | -  |
| 54 | +## 🛠️ Usage Overview |
95 | 55 |
|
96 | | -### 5. Edit CSV Data |
| 56 | +1. **Upload CSV:** Drag-and-drop or select a CSV file. The content appears in the editor. |
| 57 | +2. **Select/Upload Schema:** Choose a schema from the dropdown or upload your own JSON schema. |
| 58 | +3. **Validate:** Click "Validate Data". Errors and warnings appear below, with details per row. |
| 59 | +4. **Edit & Save:** Edit CSV directly, then save/download. Validation runs automatically after edits. |
| 60 | +5. **View Schema Docs:** Toggle the schema panel to see a human-readable Markdown version of the schema. |
97 | 61 |
|
98 | | -* You can directly edit the text in the CSV editor pane on the left. |
99 | | -* Make corrections based on the validation results or perform other modifications. |
100 | | - |
101 | | -  |
| 62 | +--- |
102 | 63 |
|
103 | | -### 6. Save Modified CSV |
| 64 | +## 🧪 Testing & Quality |
| 65 | + |
| 66 | +- **Lint:** |
| 67 | + ```sh |
| 68 | + pnpm lint |
| 69 | + ``` |
| 70 | +- **Format:** |
| 71 | + ```sh |
| 72 | + pnpm format --check |
| 73 | + ``` |
| 74 | +- **Unit Tests:** |
| 75 | + ```sh |
| 76 | + pnpm test |
| 77 | + ``` |
| 78 | +- **E2E Tests (Playwright):** |
| 79 | + ```sh |
| 80 | + pnpm e2e |
| 81 | + ``` |
104 | 82 |
|
105 | | -* Click the "Save CSV" button. |
106 | | -* This will trigger a download of the currently displayed CSV content as a `.csv` file. |
| 83 | +--- |
107 | 84 |
|
108 | | -### 7. Automatic Re-validation After Save |
| 85 | +## ⚙️ CI/CD & Deployment |
109 | 86 |
|
110 | | -* After saving the CSV, the application automatically re-parses the data from the editor and runs the validation again with the selected schema. |
111 | | -* The results panel will update to reflect the validity of the *saved* data. |
| 87 | +- **CI:** Automated via GitHub Actions (`.github/workflows/CI.yml`). Runs lint, format, unit tests, build, and Playwright e2e tests on every push/PR. |
| 88 | +- **CD:** Static export and deploy to GitHub Pages via `.github/workflows/CD.yml`. |
| 89 | +- **Static Export:** |
| 90 | + - Next.js 15+ uses `output: 'export'` in `next.config.mjs`. |
| 91 | + - Build with: |
| 92 | + ```sh |
| 93 | + pnpm build |
| 94 | + # Output is in the out/ directory |
| 95 | + ``` |
| 96 | +- **GitHub Pages:** |
| 97 | + - Deployment is automatic from the `main` branch to the `gh-pages` branch. |
| 98 | + - Configure GitHub Pages in repo settings to serve from `gh-pages` branch. |
112 | 99 |
|
113 | 100 | --- |
114 | 101 |
|
115 | 102 | ## 💻 Tech Stack |
116 | 103 |
|
117 | | -* **Frontend:** Next.js (React Framework), TypeScript |
118 | | -* **UI Components:** Shadcn/ui, Radix UI, Tailwind CSS |
119 | | -* **CSV Parsing:** PapaParse |
120 | | -* **Schema Validation:** Ajv (Another JSON Schema Validator) |
121 | | -* **Code Editor:** CodeMirror |
122 | | -* **State Management:** React Hooks (useState, useCallback, useRef) |
123 | | -* **Asynchronous Operations:** Web Workers |
124 | | - |
125 | | - |
126 | | - |
127 | | ---- |
128 | | - |
129 | | -<div align="center"> |
130 | | - ✔️ Made with ❤️ by the fine people @ [F]it 👌 |
131 | | -</div> |
| 104 | +- **Frontend:** Next.js 15+, React 19, TypeScript |
| 105 | +- **UI:** Shadcn/ui, Radix UI, Tailwind CSS |
| 106 | +- **CSV Parsing:** PapaParse |
| 107 | +- **Schema Validation:** Ajv |
| 108 | +- **Code Editor:** Monaco/CodeMirror |
| 109 | +- **E2E:** Playwright |
| 110 | +- **CI/CD:** GitHub Actions |
132 | 111 |
|
133 | 112 | --- |
134 | 113 |
|
135 | 114 | ## 🤝 Contributing |
136 | 115 |
|
137 | | -Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. |
138 | | - |
139 | | -If you'd like to contribute code: |
140 | | -
|
141 | | -1. Fork the repository. |
142 | | -2. Create a new branch for your feature or bug fix (`git checkout -b feature/your-feature` or `git checkout -b fix/your-bug`). |
143 | | -3. Make your changes and commit them with clear messages. |
144 | | -4. Push your branch to your fork (`git push origin feature/your-feature`). |
145 | | -5. Open a Pull Request back to the main repository's `develop` branch. |
146 | | - |
147 | | -Please ensure your code adheres to the existing style and that any relevant tests pass (if applicable). |
| 116 | +Contributions are welcome! Please open issues or pull requests. Ensure your code passes lint, format, and all tests before submitting. |
148 | 117 |
|
149 | 118 | --- |
150 | 119 |
|
151 | 120 | ## 📄 License |
152 | 121 |
|
153 | | -This project is licensed under the MIT License. |
| 122 | +MIT License © 2025 Fabien Dostie, [F]it |
154 | 123 |
|
155 | | -**MIT License** |
156 | | - |
157 | | -Copyright (c) 2025 Fabien Dostie, [F]it |
158 | | - |
159 | | -Permission is hereby granted, free of charge, to any person obtaining a copy |
160 | | -of this software and associated documentation files (the "Software"), to deal |
161 | | -in the Software without restriction, including without limitation the rights |
162 | | -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
163 | | -copies of the Software, and to permit persons to whom the Software is |
164 | | -furnished to do so, subject to the following conditions: |
| 124 | +--- |
165 | 125 |
|
166 | | -The above copyright notice and this permission notice shall be included in all |
167 | | -copies or substantial portions of the Software. |
| 126 | +## 🔒 Security |
168 | 127 |
|
169 | | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
170 | | -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
171 | | -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
172 | | -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
173 | | -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
174 | | -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
175 | | -SOFTWARE. |
| 128 | +See [SECURITY.md](./SECURITY.md) for vulnerability reporting and supported versions. |
0 commit comments