hired.util#
Utilities for external dependencies and general helpers. All imports here are external to the hired package.
Functions
|
Dumps a dictionary to a YAML file using PyYAML, preserving key order and using a readable block style. |
|
Get a schema-valid resume dict from various sources (json file, json string, dict, ...) |
|
Extracts a generator of user-friendly error messages from a validation error object. |
|
Return a list of jsonschema validation error messages for the content. |
|
Loads a YAML file using PyYAML. |
|
Normalize and validate a resume-like mapping. |
|
|
|
Validate resume content using ResumeSchemaExtended (which allows extra fields). |
|
- hired.util.dump_yaml(d, yaml_path)[source]#
Dumps a dictionary to a YAML file using PyYAML, preserving key order and using a readable block style.
- Return type:
- hired.util.ensure_resume_content_dict(content_src)[source]#
Get a schema-valid resume dict from various sources (json file, json string, dict, …)
- hired.util.extract_friendly_errors(error_obj, schema=None, data=None)[source]#
Extracts a generator of user-friendly error messages from a validation error object.
This function works with both Pydantic’s ValidationError and jsonschema’s ValidationError to provide a consistent output.
- hired.util.get_jsonschema_errors(content, schema_path=None)[source]#
Return a list of jsonschema validation error messages for the content.
If jsonschema is not available or the schema file is missing, returns an empty list.
- hired.util.load_yaml(yaml_path)[source]#
Loads a YAML file using PyYAML. This works in Python 3.7+ because dicts preserve insertion order.
- Return type:
- hired.util.normalize_and_validate_resume(raw, *, strict=True)[source]#
Normalize and validate a resume-like mapping.
Prunes None values.
Validates via Pydantic ResumeSchemaExtended (allows extra fields).
If strict is True and jsonschema is available, will attempt schema validation against the packaged JSON schema (best-effort).
Returns a ResumeSchemaExtended instance on success. Raises pydantic.ValidationError on failure.
- Return type: