{"categories":[{"label":"Testing","url":"https://skillfed.io/packages/category/software-development-testing/5"}],"enrichment":{"capability":"Validates function return values and API responses against schema definitions in pytest tests, using the schema library to check data structure, types, and constraints.","skillfed_tags":["api-testing","schema-validation"],"use_cases":["Validate JSON responses from REST API endpoints match expected structure and types in integration tests.","Test that config file parsing produces the correct nested dict/list structure with proper type conversions.","Ensure backwards compatibility by checking that new API versions still satisfy older schema constraints.","Validate webhook payloads or event data conform to a contract before processing in business logic.","Check that data transformations (e.g., ORM queries, ETL pipelines) produce correctly typed and shaped output."],"what_it_does":"pytest-schema is a pytest plugin that wraps the schema library to validate Python data structures\u2014typically API responses, config objects, or parsed JSON\u2014against declarative schema definitions in test assertions. It provides functions like schema(), exact_schema(), and like_schema() that compare actual data against a template defining expected types, nested structures, optional fields, and custom validation rules (regex, enums, lambdas). When data matches the schema, the assertion passes; when it doesn't, a SchemaError is raised with details about the mismatch.\n\nThe package is designed for testing REST endpoints, webhooks, or any code that returns structured data. You define a schema once\u2014a plain Python dict with types and validators\u2014then reuse it across multiple tests. It handles optional fields, nested objects, lists, and custom predicates, making it useful for regression testing API contracts or validating config file parsing without writing repetitive type checks.","worth_installing":"Yes, if you need lightweight schema validation in pytest tests and don't require active maintenance. The package is stable and low-friction to install, but its dormant status (910 days since last release) means it won't receive updates for new pytest or Python versions. Use it for straightforward response validation; consider alternatives if you need ongoing support or complex JSON Schema features."},"id":"pytest-schema","links":{"html":"https://skillfed.io/packages/pytest-schema","md":"https://skillfed.io/packages/pytest-schema.md","pypi":"https://pypi.org/project/pytest-schema/"},"maintenance":{"status":"dormant"},"meta":{"latest_release":"2024-02-16","license_spdx":null,"license_treatment":"permissive","name":"pytest-schema","python_support":"supports_current","summary":"\ud83d\udc4d Validate return values against a schema-like object in testing"},"popularity":{"monthly_downloads":113396,"position":12342,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.1.2"}
