Commit 45a3da6
committed
Mail Servers Configuration
# Add Mail Servers Configuration JSON Schema
## Description
Adds a JSON schema for storing mail server configurations for different domains. The schema supports flexible configuration of POP3, IMAP, and SMTP servers with strict validation rules.
## Changes
### New Schema
- `src/schemas/json/mail-servers-config.json` - Main configuration schema for mail servers
### Tests
- **Positive Tests** (`src/test/mail-servers-config/`):
- `valid-complete.json` - Full configuration with POP3, IMAP, and SMTP
- `valid-minimal-imap-smtp.json` - IMAP and SMTP only
- `valid-pop-only.json` - POP3 only
- `valid-multiple-protocols.json` - Various protocol combinations for different domains
- `valid-default-ports.json` - Validation with default port values
- **Negative Tests** (`src/negative_test/mail-servers-config/`):
- `invalid-port-range.json` - Ports outside 1-65535 range
- `extra-property-domain.json` - Additional properties at domain level
- `extra-property-protocol.json` - Additional properties in protocol objects
- `empty-object.json` - Empty object (violates minProperties: 1)
- `invalid-hostname.json` - Invalid hostname format
- `missing-host.json` - Missing required host field
- `missing-port.json` - Missing required port field
- `wrong-type.json` - Incorrect data types
### Catalog Entry
Added to `src/api/json/catalog.json`:
```json
{
"name": "Mail Servers Configuration",
"description": "Schema for storing mail server configurations",
"fileMatch": [
"mail-servers-config.json",
"mail-servers-config.jsonc",
"mail-servers-config.json5",
"*.mail-servers-config.json",
"*.mail-servers-config.jsonc",
"*.mail-servers-config.json5",
"**/mail-servers-config.json",
"**/mail-servers-config.jsonc",
"**/mail-servers-config.json5"
],
"url": "https://www.schemastore.org/mail-servers-config.json"
}
```
## Schema Features
### Configuration Flexibility
1. **Optional Protocols:** Each domain can contain any combination of POP3, IMAP, and SMTP protocols
2. **Strict Protocol Validation:** Each protocol requires both host and port fields
3. **No Additional Properties:** Extra properties are disallowed at both domain and protocol levels
### Data Validation
- **Ports:** Restricted to valid range 1-65535
- **Hostname:** Validated against hostname format
- **Default Values:** Standard ports are suggested:
- POP3: 995
- IMAP: 993
- SMTP: 587
- **Minimum One Domain:** At least one domain configuration is required (`minProperties: 1`)
## Typical Usage Example
```json
{
"gmail.com": {
"imap": {"host": "imap.gmail.com", "port": 993},
"smtp": {"host": "smtp.gmail.com", "port": 587}
},
"outlook.com": {
"imap": {"host": "outlook.office365.com", "port": 993},
"smtp": {"host": "smtp.office365.com", "port": 587}
}
}
```
## Validation
- ✅ All tests pass validation with Ajv
- ✅ Schema conforms to draft-07 specification
- ✅ Compatible with strict mode
- ✅ Comprehensive edge case coverage
## Potential Use Cases
1. **Email Client Configuration:** Storing settings for different email providers
2. **Mailbox Migration:** Describing source and destination mail servers
3. **Infrastructure Documentation:** Centralized storage of company mail server configurations
4. **Automation Scripts:** Use in scripts for automatic email client configuration
## Compatibility
- Compatible with all JSON Schema validators supporting draft-07
- Supported in VS Code, IntelliJ IDEA, and other IDEs through SchemaStore
- Can be used with `yaml-language-server` for YAML files
## Checklist
- Schema follows draft-07 specification
- Added both positive and negative test cases
- All tests pass validation
- Added catalog entry with appropriate fileMatch patterns
- No breaking changes to existing schemas
- Schema is compatible with strict mode1 parent 6947e22 commit 45a3da6
14 files changed
Lines changed: 226 additions & 0 deletions
File tree
- src
- api/json
- negative_test/mail-servers-config
- schemas/json
- test/mail-servers-config
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9344 | 9344 | | |
9345 | 9345 | | |
9346 | 9346 | | |
| 9347 | + | |
| 9348 | + | |
| 9349 | + | |
| 9350 | + | |
| 9351 | + | |
| 9352 | + | |
| 9353 | + | |
| 9354 | + | |
| 9355 | + | |
| 9356 | + | |
| 9357 | + | |
| 9358 | + | |
| 9359 | + | |
| 9360 | + | |
| 9361 | + | |
| 9362 | + | |
9347 | 9363 | | |
9348 | 9364 | | |
9349 | 9365 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
0 commit comments