schema-resume-validator 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- schema_resume_validator-1.1.0/LICENSE +21 -0
- schema_resume_validator-1.1.0/MANIFEST.in +11 -0
- schema_resume_validator-1.1.0/PKG-INFO +332 -0
- schema_resume_validator-1.1.0/README.md +286 -0
- schema_resume_validator-1.1.0/pyproject.toml +70 -0
- schema_resume_validator-1.1.0/setup.cfg +4 -0
- schema_resume_validator-1.1.0/setup.py +71 -0
- schema_resume_validator-1.1.0/src/schema_resume/__init__.py +16 -0
- schema_resume_validator-1.1.0/src/schema_resume/exceptions.py +16 -0
- schema_resume_validator-1.1.0/src/schema_resume/schemas/context.jsonld +501 -0
- schema_resume_validator-1.1.0/src/schema_resume/schemas/meta-schema.json +435 -0
- schema_resume_validator-1.1.0/src/schema_resume/schemas/schema-resume.xsd +366 -0
- schema_resume_validator-1.1.0/src/schema_resume/schemas/schema.json +849 -0
- schema_resume_validator-1.1.0/src/schema_resume/validator.py +116 -0
- schema_resume_validator-1.1.0/src/schema_resume_validator.egg-info/PKG-INFO +332 -0
- schema_resume_validator-1.1.0/src/schema_resume_validator.egg-info/SOURCES.txt +18 -0
- schema_resume_validator-1.1.0/src/schema_resume_validator.egg-info/dependency_links.txt +1 -0
- schema_resume_validator-1.1.0/src/schema_resume_validator.egg-info/not-zip-safe +1 -0
- schema_resume_validator-1.1.0/src/schema_resume_validator.egg-info/requires.txt +12 -0
- schema_resume_validator-1.1.0/src/schema_resume_validator.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tradik
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Include documentation and license files
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
|
|
5
|
+
# Include schema files
|
|
6
|
+
recursive-include src/schema_resume/schemas *.json *.jsonld *.xsd
|
|
7
|
+
|
|
8
|
+
# Exclude development and build artifacts
|
|
9
|
+
global-exclude __pycache__
|
|
10
|
+
global-exclude *.py[co]
|
|
11
|
+
global-exclude .DS_Store
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: schema-resume-validator
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: JSON Schema validator for Schema Resume - comprehensive CV/Resume validation with JSON-LD support
|
|
5
|
+
Home-page: https://schema-resume.org/
|
|
6
|
+
Author: Schema Resume
|
|
7
|
+
Author-email: Schema Resume <info@schema-resume.org>
|
|
8
|
+
Maintainer: Tradik
|
|
9
|
+
Maintainer-email: Tradik <support@tradik.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
Project-URL: Homepage, https://schema-resume.org/
|
|
12
|
+
Project-URL: Documentation, https://github.com/tradik/schema-resume
|
|
13
|
+
Project-URL: Repository, https://github.com/tradik/schema-resume
|
|
14
|
+
Project-URL: Issues, https://github.com/tradik/schema-resume/issues
|
|
15
|
+
Keywords: json-schema,resume,cv,curriculum-vitae,validation,json-ld,parser
|
|
16
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Topic :: Text Processing
|
|
27
|
+
Classifier: Topic :: Utilities
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: jsonschema>=4.17.0
|
|
32
|
+
Requires-Dist: requests>=2.28.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
39
|
+
Provides-Extra: xml
|
|
40
|
+
Requires-Dist: lxml>=4.9.0; extra == "xml"
|
|
41
|
+
Dynamic: author
|
|
42
|
+
Dynamic: home-page
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
Dynamic: maintainer
|
|
45
|
+
Dynamic: requires-python
|
|
46
|
+
|
|
47
|
+
# schema-resume-validator
|
|
48
|
+
|
|
49
|
+
[](https://pypi.org/project/schema-resume-validator/)
|
|
50
|
+
[](https://pypi.org/project/schema-resume-validator/)
|
|
51
|
+
[](https://opensource.org/licenses/MIT)
|
|
52
|
+
|
|
53
|
+
Official Python package for validating resumes against the [Schema Resume](https://schema-resume.org/) JSON Schema.
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install schema-resume-validator
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
For XML validation support:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install schema-resume-validator[xml]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
### Basic Validation
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from schema_resume import validate_resume
|
|
73
|
+
|
|
74
|
+
resume = {
|
|
75
|
+
"$schema": "https://schema-resume.org/schema.json",
|
|
76
|
+
"basics": {
|
|
77
|
+
"name": "John Doe",
|
|
78
|
+
"label": "Software Engineer",
|
|
79
|
+
"email": "john.doe@example.com"
|
|
80
|
+
},
|
|
81
|
+
"work": [
|
|
82
|
+
{
|
|
83
|
+
"name": "Tech Corp",
|
|
84
|
+
"position": "Senior Developer",
|
|
85
|
+
"startDate": "2020-01"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
result = validate_resume(resume)
|
|
91
|
+
|
|
92
|
+
if result["valid"]:
|
|
93
|
+
print("✓ Resume is valid!")
|
|
94
|
+
else:
|
|
95
|
+
print("✗ Validation errors:")
|
|
96
|
+
for error in result["errors"]:
|
|
97
|
+
print(f" - {error['path']}: {error['message']}")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Using the Validator Class
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from schema_resume import ResumeValidator
|
|
104
|
+
|
|
105
|
+
# Create validator instance
|
|
106
|
+
validator = ResumeValidator()
|
|
107
|
+
|
|
108
|
+
# Validate from dictionary
|
|
109
|
+
resume_data = {"basics": {"name": "Jane Doe"}}
|
|
110
|
+
result = validator.validate(resume_data)
|
|
111
|
+
|
|
112
|
+
# Validate from JSON file
|
|
113
|
+
result = validator.validate("path/to/resume.json")
|
|
114
|
+
|
|
115
|
+
# Validate from JSON string
|
|
116
|
+
json_string = '{"basics": {"name": "John Smith"}}'
|
|
117
|
+
result = validator.validate(json_string)
|
|
118
|
+
|
|
119
|
+
# Access schema files
|
|
120
|
+
schema = validator.get_schema()
|
|
121
|
+
meta_schema = validator.get_meta_schema()
|
|
122
|
+
context = validator.get_context()
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Custom Schema
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from pathlib import Path
|
|
129
|
+
from schema_resume import ResumeValidator
|
|
130
|
+
|
|
131
|
+
# Use custom schema file
|
|
132
|
+
validator = ResumeValidator(schema_path=Path("custom-schema.json"))
|
|
133
|
+
result = validator.validate(resume_data)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## API Reference
|
|
137
|
+
|
|
138
|
+
### `validate_resume(resume)`
|
|
139
|
+
|
|
140
|
+
Convenience function to validate a resume.
|
|
141
|
+
|
|
142
|
+
**Parameters:**
|
|
143
|
+
- `resume`: Resume data as dict, JSON string, or Path to JSON file
|
|
144
|
+
|
|
145
|
+
**Returns:** Dictionary with:
|
|
146
|
+
- `valid` (bool): Whether the resume is valid
|
|
147
|
+
- `errors` (list): List of validation errors (empty if valid)
|
|
148
|
+
|
|
149
|
+
### `ResumeValidator`
|
|
150
|
+
|
|
151
|
+
Main validator class.
|
|
152
|
+
|
|
153
|
+
#### `__init__(schema_path=None)`
|
|
154
|
+
|
|
155
|
+
Initialize validator with optional custom schema.
|
|
156
|
+
|
|
157
|
+
**Parameters:**
|
|
158
|
+
- `schema_path` (optional): Path to custom schema file
|
|
159
|
+
|
|
160
|
+
#### `validate(resume)`
|
|
161
|
+
|
|
162
|
+
Validate a resume document.
|
|
163
|
+
|
|
164
|
+
**Parameters:**
|
|
165
|
+
- `resume`: Resume data as dict, JSON string, or Path to JSON file
|
|
166
|
+
|
|
167
|
+
**Returns:** Dictionary with validation results
|
|
168
|
+
|
|
169
|
+
#### `get_schema()`
|
|
170
|
+
|
|
171
|
+
Returns the JSON Schema dictionary.
|
|
172
|
+
|
|
173
|
+
#### `get_meta_schema()`
|
|
174
|
+
|
|
175
|
+
Returns the meta-schema dictionary.
|
|
176
|
+
|
|
177
|
+
#### `get_context()`
|
|
178
|
+
|
|
179
|
+
Returns the JSON-LD context dictionary.
|
|
180
|
+
|
|
181
|
+
## Validation Examples
|
|
182
|
+
|
|
183
|
+
### Complete Resume Example
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from schema_resume import validate_resume
|
|
187
|
+
|
|
188
|
+
resume = {
|
|
189
|
+
"$schema": "https://schema-resume.org/schema.json",
|
|
190
|
+
"basics": {
|
|
191
|
+
"name": "Jane Smith",
|
|
192
|
+
"label": "Full Stack Developer",
|
|
193
|
+
"email": "jane@example.com",
|
|
194
|
+
"phone": "+1-555-123-4567",
|
|
195
|
+
"url": "https://janesmith.dev",
|
|
196
|
+
"summary": "Experienced developer with 8+ years in web development",
|
|
197
|
+
"location": {
|
|
198
|
+
"city": "San Francisco",
|
|
199
|
+
"countryCode": "US",
|
|
200
|
+
"region": "California"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"work": [
|
|
204
|
+
{
|
|
205
|
+
"name": "Tech Company",
|
|
206
|
+
"position": "Senior Developer",
|
|
207
|
+
"startDate": "2020-03",
|
|
208
|
+
"highlights": [
|
|
209
|
+
"Led team of 5 developers",
|
|
210
|
+
"Improved performance by 40%"
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"education": [
|
|
215
|
+
{
|
|
216
|
+
"institution": "University of Technology",
|
|
217
|
+
"area": "Computer Science",
|
|
218
|
+
"studyType": "Bachelor",
|
|
219
|
+
"startDate": "2012",
|
|
220
|
+
"endDate": "2016"
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"skills": [
|
|
224
|
+
{
|
|
225
|
+
"name": "Web Development",
|
|
226
|
+
"level": "Expert",
|
|
227
|
+
"keywords": ["JavaScript", "React", "Node.js"]
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
result = validate_resume(resume)
|
|
233
|
+
print(f"Valid: {result['valid']}")
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Handling Validation Errors
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
from schema_resume import ResumeValidator
|
|
240
|
+
|
|
241
|
+
validator = ResumeValidator()
|
|
242
|
+
|
|
243
|
+
invalid_resume = {
|
|
244
|
+
"basics": {
|
|
245
|
+
"email": "not-an-email" # Invalid email format
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
result = validator.validate(invalid_resume)
|
|
250
|
+
|
|
251
|
+
if not result["valid"]:
|
|
252
|
+
for error in result["errors"]:
|
|
253
|
+
print(f"Field: {error['path']}")
|
|
254
|
+
print(f"Error: {error['message']}")
|
|
255
|
+
print(f"Validator: {error['validator']}")
|
|
256
|
+
print()
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Validating from File
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
from schema_resume import validate_resume
|
|
263
|
+
from pathlib import Path
|
|
264
|
+
|
|
265
|
+
# Validate from file path
|
|
266
|
+
result = validate_resume(Path("resume.json"))
|
|
267
|
+
|
|
268
|
+
# Or using string path
|
|
269
|
+
result = validate_resume("resume.json")
|
|
270
|
+
|
|
271
|
+
if result["valid"]:
|
|
272
|
+
print("Resume file is valid!")
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Development
|
|
276
|
+
|
|
277
|
+
### Running Tests
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# Install development dependencies
|
|
281
|
+
pip install -e ".[dev]"
|
|
282
|
+
|
|
283
|
+
# Run tests
|
|
284
|
+
pytest
|
|
285
|
+
|
|
286
|
+
# Run tests with coverage
|
|
287
|
+
pytest --cov=schema_resume --cov-report=html
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Code Formatting
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Format code with black
|
|
294
|
+
black src/
|
|
295
|
+
|
|
296
|
+
# Check with flake8
|
|
297
|
+
flake8 src/
|
|
298
|
+
|
|
299
|
+
# Type checking with mypy
|
|
300
|
+
mypy src/
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Schema Files Included
|
|
304
|
+
|
|
305
|
+
This package includes all necessary schema files:
|
|
306
|
+
|
|
307
|
+
- **schema.json** - Main JSON Schema for resume validation
|
|
308
|
+
- **meta-schema.json** - Meta-schema for self-validation
|
|
309
|
+
- **context.jsonld** - JSON-LD context for semantic web integration
|
|
310
|
+
- **schema-resume.xsd** - XML Schema Definition (XSD) for XML validation
|
|
311
|
+
|
|
312
|
+
## Links
|
|
313
|
+
|
|
314
|
+
- **Website**: https://schema-resume.org/
|
|
315
|
+
- **Documentation**: https://github.com/tradik/schema-resume
|
|
316
|
+
- **Online Validator**: https://schema-resume.org/validator.html
|
|
317
|
+
- **PyPI**: https://pypi.org/project/schema-resume-validator/
|
|
318
|
+
- **Issues**: https://github.com/tradik/schema-resume/issues
|
|
319
|
+
|
|
320
|
+
## Support
|
|
321
|
+
|
|
322
|
+
For questions or issues:
|
|
323
|
+
- Email: info@schema-resume.org or support@tradik.com
|
|
324
|
+
- GitHub Issues: https://github.com/tradik/schema-resume/issues
|
|
325
|
+
|
|
326
|
+
## License
|
|
327
|
+
|
|
328
|
+
MIT License - see LICENSE file for details
|
|
329
|
+
|
|
330
|
+
## Contributing
|
|
331
|
+
|
|
332
|
+
Contributions are welcome! Please see the [Contributing Guide](https://github.com/tradik/schema-resume/blob/main/CONTRIBUTING.md).
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# schema-resume-validator
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/schema-resume-validator/)
|
|
4
|
+
[](https://pypi.org/project/schema-resume-validator/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
Official Python package for validating resumes against the [Schema Resume](https://schema-resume.org/) JSON Schema.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install schema-resume-validator
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
For XML validation support:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install schema-resume-validator[xml]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Basic Validation
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from schema_resume import validate_resume
|
|
27
|
+
|
|
28
|
+
resume = {
|
|
29
|
+
"$schema": "https://schema-resume.org/schema.json",
|
|
30
|
+
"basics": {
|
|
31
|
+
"name": "John Doe",
|
|
32
|
+
"label": "Software Engineer",
|
|
33
|
+
"email": "john.doe@example.com"
|
|
34
|
+
},
|
|
35
|
+
"work": [
|
|
36
|
+
{
|
|
37
|
+
"name": "Tech Corp",
|
|
38
|
+
"position": "Senior Developer",
|
|
39
|
+
"startDate": "2020-01"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
result = validate_resume(resume)
|
|
45
|
+
|
|
46
|
+
if result["valid"]:
|
|
47
|
+
print("✓ Resume is valid!")
|
|
48
|
+
else:
|
|
49
|
+
print("✗ Validation errors:")
|
|
50
|
+
for error in result["errors"]:
|
|
51
|
+
print(f" - {error['path']}: {error['message']}")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Using the Validator Class
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from schema_resume import ResumeValidator
|
|
58
|
+
|
|
59
|
+
# Create validator instance
|
|
60
|
+
validator = ResumeValidator()
|
|
61
|
+
|
|
62
|
+
# Validate from dictionary
|
|
63
|
+
resume_data = {"basics": {"name": "Jane Doe"}}
|
|
64
|
+
result = validator.validate(resume_data)
|
|
65
|
+
|
|
66
|
+
# Validate from JSON file
|
|
67
|
+
result = validator.validate("path/to/resume.json")
|
|
68
|
+
|
|
69
|
+
# Validate from JSON string
|
|
70
|
+
json_string = '{"basics": {"name": "John Smith"}}'
|
|
71
|
+
result = validator.validate(json_string)
|
|
72
|
+
|
|
73
|
+
# Access schema files
|
|
74
|
+
schema = validator.get_schema()
|
|
75
|
+
meta_schema = validator.get_meta_schema()
|
|
76
|
+
context = validator.get_context()
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Custom Schema
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from pathlib import Path
|
|
83
|
+
from schema_resume import ResumeValidator
|
|
84
|
+
|
|
85
|
+
# Use custom schema file
|
|
86
|
+
validator = ResumeValidator(schema_path=Path("custom-schema.json"))
|
|
87
|
+
result = validator.validate(resume_data)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## API Reference
|
|
91
|
+
|
|
92
|
+
### `validate_resume(resume)`
|
|
93
|
+
|
|
94
|
+
Convenience function to validate a resume.
|
|
95
|
+
|
|
96
|
+
**Parameters:**
|
|
97
|
+
- `resume`: Resume data as dict, JSON string, or Path to JSON file
|
|
98
|
+
|
|
99
|
+
**Returns:** Dictionary with:
|
|
100
|
+
- `valid` (bool): Whether the resume is valid
|
|
101
|
+
- `errors` (list): List of validation errors (empty if valid)
|
|
102
|
+
|
|
103
|
+
### `ResumeValidator`
|
|
104
|
+
|
|
105
|
+
Main validator class.
|
|
106
|
+
|
|
107
|
+
#### `__init__(schema_path=None)`
|
|
108
|
+
|
|
109
|
+
Initialize validator with optional custom schema.
|
|
110
|
+
|
|
111
|
+
**Parameters:**
|
|
112
|
+
- `schema_path` (optional): Path to custom schema file
|
|
113
|
+
|
|
114
|
+
#### `validate(resume)`
|
|
115
|
+
|
|
116
|
+
Validate a resume document.
|
|
117
|
+
|
|
118
|
+
**Parameters:**
|
|
119
|
+
- `resume`: Resume data as dict, JSON string, or Path to JSON file
|
|
120
|
+
|
|
121
|
+
**Returns:** Dictionary with validation results
|
|
122
|
+
|
|
123
|
+
#### `get_schema()`
|
|
124
|
+
|
|
125
|
+
Returns the JSON Schema dictionary.
|
|
126
|
+
|
|
127
|
+
#### `get_meta_schema()`
|
|
128
|
+
|
|
129
|
+
Returns the meta-schema dictionary.
|
|
130
|
+
|
|
131
|
+
#### `get_context()`
|
|
132
|
+
|
|
133
|
+
Returns the JSON-LD context dictionary.
|
|
134
|
+
|
|
135
|
+
## Validation Examples
|
|
136
|
+
|
|
137
|
+
### Complete Resume Example
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from schema_resume import validate_resume
|
|
141
|
+
|
|
142
|
+
resume = {
|
|
143
|
+
"$schema": "https://schema-resume.org/schema.json",
|
|
144
|
+
"basics": {
|
|
145
|
+
"name": "Jane Smith",
|
|
146
|
+
"label": "Full Stack Developer",
|
|
147
|
+
"email": "jane@example.com",
|
|
148
|
+
"phone": "+1-555-123-4567",
|
|
149
|
+
"url": "https://janesmith.dev",
|
|
150
|
+
"summary": "Experienced developer with 8+ years in web development",
|
|
151
|
+
"location": {
|
|
152
|
+
"city": "San Francisco",
|
|
153
|
+
"countryCode": "US",
|
|
154
|
+
"region": "California"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"work": [
|
|
158
|
+
{
|
|
159
|
+
"name": "Tech Company",
|
|
160
|
+
"position": "Senior Developer",
|
|
161
|
+
"startDate": "2020-03",
|
|
162
|
+
"highlights": [
|
|
163
|
+
"Led team of 5 developers",
|
|
164
|
+
"Improved performance by 40%"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"education": [
|
|
169
|
+
{
|
|
170
|
+
"institution": "University of Technology",
|
|
171
|
+
"area": "Computer Science",
|
|
172
|
+
"studyType": "Bachelor",
|
|
173
|
+
"startDate": "2012",
|
|
174
|
+
"endDate": "2016"
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"skills": [
|
|
178
|
+
{
|
|
179
|
+
"name": "Web Development",
|
|
180
|
+
"level": "Expert",
|
|
181
|
+
"keywords": ["JavaScript", "React", "Node.js"]
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
result = validate_resume(resume)
|
|
187
|
+
print(f"Valid: {result['valid']}")
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Handling Validation Errors
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
from schema_resume import ResumeValidator
|
|
194
|
+
|
|
195
|
+
validator = ResumeValidator()
|
|
196
|
+
|
|
197
|
+
invalid_resume = {
|
|
198
|
+
"basics": {
|
|
199
|
+
"email": "not-an-email" # Invalid email format
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
result = validator.validate(invalid_resume)
|
|
204
|
+
|
|
205
|
+
if not result["valid"]:
|
|
206
|
+
for error in result["errors"]:
|
|
207
|
+
print(f"Field: {error['path']}")
|
|
208
|
+
print(f"Error: {error['message']}")
|
|
209
|
+
print(f"Validator: {error['validator']}")
|
|
210
|
+
print()
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Validating from File
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
from schema_resume import validate_resume
|
|
217
|
+
from pathlib import Path
|
|
218
|
+
|
|
219
|
+
# Validate from file path
|
|
220
|
+
result = validate_resume(Path("resume.json"))
|
|
221
|
+
|
|
222
|
+
# Or using string path
|
|
223
|
+
result = validate_resume("resume.json")
|
|
224
|
+
|
|
225
|
+
if result["valid"]:
|
|
226
|
+
print("Resume file is valid!")
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
### Running Tests
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Install development dependencies
|
|
235
|
+
pip install -e ".[dev]"
|
|
236
|
+
|
|
237
|
+
# Run tests
|
|
238
|
+
pytest
|
|
239
|
+
|
|
240
|
+
# Run tests with coverage
|
|
241
|
+
pytest --cov=schema_resume --cov-report=html
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Code Formatting
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Format code with black
|
|
248
|
+
black src/
|
|
249
|
+
|
|
250
|
+
# Check with flake8
|
|
251
|
+
flake8 src/
|
|
252
|
+
|
|
253
|
+
# Type checking with mypy
|
|
254
|
+
mypy src/
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Schema Files Included
|
|
258
|
+
|
|
259
|
+
This package includes all necessary schema files:
|
|
260
|
+
|
|
261
|
+
- **schema.json** - Main JSON Schema for resume validation
|
|
262
|
+
- **meta-schema.json** - Meta-schema for self-validation
|
|
263
|
+
- **context.jsonld** - JSON-LD context for semantic web integration
|
|
264
|
+
- **schema-resume.xsd** - XML Schema Definition (XSD) for XML validation
|
|
265
|
+
|
|
266
|
+
## Links
|
|
267
|
+
|
|
268
|
+
- **Website**: https://schema-resume.org/
|
|
269
|
+
- **Documentation**: https://github.com/tradik/schema-resume
|
|
270
|
+
- **Online Validator**: https://schema-resume.org/validator.html
|
|
271
|
+
- **PyPI**: https://pypi.org/project/schema-resume-validator/
|
|
272
|
+
- **Issues**: https://github.com/tradik/schema-resume/issues
|
|
273
|
+
|
|
274
|
+
## Support
|
|
275
|
+
|
|
276
|
+
For questions or issues:
|
|
277
|
+
- Email: info@schema-resume.org or support@tradik.com
|
|
278
|
+
- GitHub Issues: https://github.com/tradik/schema-resume/issues
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
MIT License - see LICENSE file for details
|
|
283
|
+
|
|
284
|
+
## Contributing
|
|
285
|
+
|
|
286
|
+
Contributions are welcome! Please see the [Contributing Guide](https://github.com/tradik/schema-resume/blob/main/CONTRIBUTING.md).
|