schema-resume-validator 1.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0e49ee98c8f5eb9d19a35053731446e94e6e9cc12471a92c965d39ab8eb5855c
4
+ data.tar.gz: 0326c213338e27f959ed7b4e515a409892a0c3ab06ca7d95a398b6a08635e611
5
+ SHA512:
6
+ metadata.gz: ea78337519c989d8f312ced4e5fac349bdb6bb2719aeb14f72d45608f823f94f23e739d54ebe76fe8a6c501a9e3d12c1189529778e0bb1e111ce33165cb41b3c
7
+ data.tar.gz: 414898422facfaeab31184cc9688e783a8721a3273b3b4fdb2c2c89a78471984a37729f19427084734de50f6a79cca19911faf4ca993415e875a2fd10b24531c
data/LICENSE ADDED
@@ -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.
data/README.md ADDED
@@ -0,0 +1,227 @@
1
+ # Schema Resume Validator (Ruby)
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/schema-resume-validator.svg)](https://badge.fury.io/rb/schema-resume-validator)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Official Ruby gem for validating resumes against the [Schema Resume](https://schema-resume.org/) JSON Schema.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'schema-resume-validator'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ ```bash
19
+ bundle install
20
+ ```
21
+
22
+ Or install it yourself as:
23
+
24
+ ```bash
25
+ gem install schema-resume-validator
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ### Basic Validation
31
+
32
+ ```ruby
33
+ require 'schema_resume'
34
+
35
+ resume = {
36
+ "$schema" => "https://schema-resume.org/schema.json",
37
+ "basics" => {
38
+ "name" => "John Doe",
39
+ "label" => "Software Engineer",
40
+ "email" => "john.doe@example.com"
41
+ },
42
+ "work" => [
43
+ {
44
+ "name" => "Tech Corp",
45
+ "position" => "Senior Developer",
46
+ "startDate" => "2020-01"
47
+ }
48
+ ]
49
+ }
50
+
51
+ result = SchemaResume.validate(resume)
52
+
53
+ if result[:valid]
54
+ puts "✓ Resume is valid!"
55
+ else
56
+ puts "✗ Validation errors:"
57
+ result[:errors].each do |error|
58
+ puts " - #{error[:path]}: #{error[:message]}"
59
+ end
60
+ end
61
+ ```
62
+
63
+ ### Using the Validator Class
64
+
65
+ ```ruby
66
+ require 'schema_resume'
67
+
68
+ # Create validator instance
69
+ validator = SchemaResume::Validator.new
70
+
71
+ # Validate from hash
72
+ resume_data = { "basics" => { "name" => "Jane Doe" } }
73
+ result = validator.validate(resume_data)
74
+
75
+ # Validate from JSON string
76
+ json_string = '{"basics": {"name": "John Smith"}}'
77
+ result = validator.validate(json_string)
78
+
79
+ # Access schema files
80
+ schema = validator.get_schema
81
+ meta_schema = validator.get_meta_schema
82
+ context = validator.get_context
83
+ ```
84
+
85
+ ### Custom Schema
86
+
87
+ ```ruby
88
+ require 'schema_resume'
89
+
90
+ # Use custom schema file
91
+ validator = SchemaResume::Validator.new(schema_path: 'custom-schema.json')
92
+ result = validator.validate(resume_data)
93
+ ```
94
+
95
+ ## API Reference
96
+
97
+ ### `SchemaResume.validate(resume)`
98
+
99
+ Convenience method to validate a resume.
100
+
101
+ **Parameters:**
102
+ - `resume` (Hash or String): Resume data as hash or JSON string
103
+
104
+ **Returns:** Hash with:
105
+ - `:valid` (Boolean): Whether the resume is valid
106
+ - `:errors` (Array): List of validation errors (empty if valid)
107
+
108
+ ### `SchemaResume::Validator`
109
+
110
+ Main validator class.
111
+
112
+ #### `new(schema_path: nil)`
113
+
114
+ Initialize validator with optional custom schema.
115
+
116
+ **Parameters:**
117
+ - `schema_path` (String, optional): Path to custom schema file
118
+
119
+ #### `validate(resume)`
120
+
121
+ Validate a resume document.
122
+
123
+ **Parameters:**
124
+ - `resume` (Hash or String): Resume data
125
+
126
+ **Returns:** Hash with validation results
127
+
128
+ #### `get_schema`
129
+
130
+ Returns the JSON Schema as a hash.
131
+
132
+ #### `get_meta_schema`
133
+
134
+ Returns the meta-schema as a hash.
135
+
136
+ #### `get_context`
137
+
138
+ Returns the JSON-LD context as a hash.
139
+
140
+ ## Complete Example
141
+
142
+ ```ruby
143
+ require 'schema_resume'
144
+
145
+ # Create validator
146
+ validator = SchemaResume::Validator.new
147
+
148
+ # Complete resume example
149
+ resume = {
150
+ "$schema" => "https://schema-resume.org/schema.json",
151
+ "basics" => {
152
+ "name" => "Jane Smith",
153
+ "label" => "Full Stack Developer",
154
+ "email" => "jane@example.com",
155
+ "phone" => "+1-555-123-4567",
156
+ "url" => "https://janesmith.dev",
157
+ "summary" => "Experienced developer with 8+ years in web development",
158
+ "location" => {
159
+ "city" => "San Francisco",
160
+ "countryCode" => "US",
161
+ "region" => "California"
162
+ }
163
+ },
164
+ "work" => [
165
+ {
166
+ "name" => "Tech Company",
167
+ "position" => "Senior Developer",
168
+ "startDate" => "2020-03",
169
+ "highlights" => [
170
+ "Led team of 5 developers",
171
+ "Improved performance by 40%"
172
+ ]
173
+ }
174
+ ],
175
+ "skills" => [
176
+ {
177
+ "name" => "Web Development",
178
+ "level" => "Expert",
179
+ "keywords" => ["JavaScript", "React", "Node.js"]
180
+ }
181
+ ]
182
+ }
183
+
184
+ # Validate
185
+ result = validator.validate(resume)
186
+
187
+ if result[:valid]
188
+ puts "✓ Resume is valid!"
189
+ puts "\nResume Summary:"
190
+ puts " Name: #{resume['basics']['name']}"
191
+ puts " Title: #{resume['basics']['label']}"
192
+ puts " Email: #{resume['basics']['email']}"
193
+ else
194
+ puts "✗ Validation failed:"
195
+ result[:errors].each_with_index do |error, i|
196
+ puts "\nError #{i + 1}:"
197
+ puts " Path: #{error[:path]}"
198
+ puts " Message: #{error[:message]}"
199
+ end
200
+ end
201
+ ```
202
+
203
+ ## Requirements
204
+
205
+ - Ruby 2.7 or higher
206
+
207
+ ## Links
208
+
209
+ - **Website**: https://schema-resume.org/
210
+ - **Documentation**: https://github.com/tradik/schema-resume
211
+ - **Online Validator**: https://schema-resume.org/validator.html
212
+ - **RubyGems**: https://rubygems.org/gems/schema-resume-validator
213
+ - **Issues**: https://github.com/tradik/schema-resume/issues
214
+
215
+ ## Support
216
+
217
+ For questions or issues:
218
+ - Email: info@schema-resume.org or support@tradik.com
219
+ - GitHub Issues: https://github.com/tradik/schema-resume/issues
220
+
221
+ ## License
222
+
223
+ MIT License - see LICENSE file for details
224
+
225
+ ## Contributing
226
+
227
+ Contributions are welcome! Please see the [Contributing Guide](https://github.com/tradik/schema-resume/blob/main/CONTRIBUTING.md).