{"record":{"id":"c02a76626c1835e3","repo":"apache/beam","slug":"please-install-jsonschema-for-better-provider-validation-of","errorCode":null,"errorMessage":"Please install jsonschema for better provider validation of \"{type}\"","messagePattern":"Please install jsonschema for better provider validation of \"(.+?)\"","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/python/apache_beam/yaml/yaml_provider.py","lineNumber":523,"sourceCode":"    return self._transforms[type].get(\n        'requires_inputs', super().requires_inputs(type, args))\n\n  def create_transform(\n      self,\n      type: str,\n      args: Mapping[str, Any],\n      yaml_create_transform: Callable[\n          [Mapping[str, Any], Iterable[beam.PCollection]], beam.PTransform]\n  ) -> beam.PTransform:\n    from apache_beam.yaml.yaml_transform import SafeLineLoader\n    from apache_beam.yaml.yaml_transform import expand_jinja\n    from apache_beam.yaml.yaml_transform import preprocess\n    spec = self._transforms[type]\n    try:\n      import jsonschema\n      jsonschema.validate(args, self.json_config_schema(type))\n    except ImportError:\n      warnings.warn(\n          'Please install jsonschema '\n          f'for better provider validation of \"{type}\"')\n    body = spec['body']\n    # Stringify to apply jinja.\n    if isinstance(body, str):\n      body_str = body\n    else:\n      body_str = yaml.safe_dump(SafeLineLoader.strip_metadata(body))\n    # Now re-parse resolved templatization.\n    search_paths = [FileSystems.split(self._provider_base_path)[0]\n                    ] if self._provider_base_path else []\n    body = yaml.load(\n        expand_jinja(body_str, args, search_paths), Loader=SafeLineLoader)\n    if (body.get('type') == 'chain' and 'input' not in body and\n        spec.get('requires_inputs', True)):\n      body['input'] = 'input'\n    return yaml_create_transform(preprocess(body))  # type: ignore\n","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_provider.py#L505-L541","documentation":"When a YAML provider creates a transform of a given type, it validates the arguments against the provider's json_config_schema using jsonschema. If the jsonschema package is not installed, it catches ImportError, warns 'Please install jsonschema for better provider validation of \"<type>\"', and proceeds without validating args, so malformed configs will only fail later at runtime.","triggerScenarios":"Running a Beam YAML pipeline whose provider's create_transform is invoked in an environment where the optional jsonschema package is absent.","commonSituations":"Minimal installs of apache-beam[yaml] without extras, slim Docker images, or Airflow/managed environments lacking the optional validation dependency.","solutions":["pip install jsonschema (or pip install apache-beam[yaml]) so validation runs.","Re-run the pipeline; arg errors will now be caught up front with schema messages.","Optionally add jsonschema to your deployment image/requirements to keep validation available.","If you cannot install it, validate your YAML args manually against the provider's documented schema."],"exampleFix":"// before\npip install apache-beam  # no jsonschema\n// after\npip install 'apache-beam[yaml]'  # includes jsonschema","handlingStrategy":"fallback","validationCode":"try:\n    import jsonschema  # noqa: F401\n    JSONSCHEMA_OK = True\nexcept ImportError:\n    JSONSCHEMA_OK = False","typeGuard":null,"tryCatchPattern":"if JSONSCHEMA_OK:\n    run_yaml_pipeline(spec)\nelse:\n    print('jsonschema missing; YAML args will not be validated up front')","preventionTips":["Install apache-beam[yaml] so jsonschema ships with the extra","Add jsonschema to production image requirements","Validate YAML pipeline specs locally with jsonschema before submission"],"tags":["yaml","validation","missing-dependency","jsonschema"],"backgroundTag":"missing-optional-dependency","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}