Fix scraper validation rules for allowed keys and remote field format#653
Merged
lalalaurentiu merged 7 commits intomainfrom Oct 2, 2025
Merged
Conversation
… remote field validation Co-authored-by: lalalaurentiu <67306273+lalalaurentiu@users.noreply.github.com>
Co-authored-by: lalalaurentiu <67306273+lalalaurentiu@users.noreply.github.com>
Co-authored-by: lalalaurentiu <67306273+lalalaurentiu@users.noreply.github.com>
Co-authored-by: lalalaurentiu <67306273+lalalaurentiu@users.noreply.github.com>
… examples Co-authored-by: lalalaurentiu <67306273+lalalaurentiu@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix scraper validation rules for allowed keys
Fix scraper validation rules for allowed keys and remote field format
Sep 30, 2025
lalalaurentiu
approved these changes
Oct 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes the validation logic in
__test__/runTest.pyto enforce correct key rules and proper remote field format validation, addressing inconsistent scraper outputs.Changes Made
Updated Validation Rules
Before:
job_title,job_link,city,county,country,companyAfter:
Required keys (must be present with non-None values):
companyjob_titlejob_linkOptional keys (may be present):
citycountyremoteAll other keys rejected (including
country)Remote Field Validation
Added comprehensive validation for the
remotefield when present:remote,on-site,hybridValid examples:
{"remote": ["remote"]} {"remote": ["on-site", "remote"]} {"remote": ["hybrid"]} {"remote": []}Invalid examples:
{"remote": "remote"} // ❌ Must be a list {"remote": ["Remote"]} // ❌ Must be lowercase {"remote": ["work-from-home"]} // ❌ Invalid valueError Messages
Added clear, descriptive error messages for all validation failures:
Required key 'company' is missing!Key 'country' is not allowed! Allowed keys are: company, job_title, job_link, city, county, remoteKey 'remote' must be a list, got str!Remote value 'Remote' must be lowercase!Bug Fix
Fixed regex pattern from
(\[.*?\])to(\[.*\])to properly handle nested arrays in JSON output (e.g.,"remote": ["remote"]).Testing
Added comprehensive unit tests in
__test__/test_validation.py:Run tests with:
Documentation
Added complete documentation in
__test__/README.mdincluding:Breaking Changes⚠️
This PR introduces breaking changes. Existing scrapers that use:
countryfield (e.g.,inetum.py,uipath.py)remoteas string instead of list (e.g.,amazon.py)"Remote")...will now fail validation and need to be updated to comply with the new rules.
Files Changed
__test__/runTest.py- Updated validation logic with new rules__test__/test_validation.py- Added comprehensive unit tests (new file)__test__/README.md- Added complete documentation (new file)Fixes #[issue_number]
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.