{"record":{"id":"5f54a7304b3dead8","repo":"sqlmapproject/sqlmap","slug":"the-provided-openapi-swagger-specification-is-not","errorCode":null,"errorMessage":"the provided OpenAPI/Swagger specification is not JSON and the optional 'pyyaml' module (needed for YAML specifications) is not available","messagePattern":"the provided OpenAPI/Swagger specification is not JSON and the optional 'pyyaml' module \\(needed for YAML specifications\\) is not available","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/parse/openapi.py","lineNumber":37,"sourceCode":"    import yaml                                          # optional (only needed for YAML specs)\nexcept ImportError:\n    yaml = None\n\n# Best-effort extraction of concrete request targets from an OpenAPI (v3) / Swagger (v2) document. The\n# document is treated as a request generator, NOT a contract to validate: for every operation a single\n# concrete request is synthesized (base URL + filled path + example query/body from the schema) and any\n# operation that cannot be built is skipped with a warning, so a loose/incomplete spec degrades gracefully.\n\nMAX_REF_DEPTH = 25\n\ndef _loadSpec(content):\n    try:\n        return json.loads(content)\n    except ValueError:\n        if yaml is None:\n            errMsg = \"the provided OpenAPI/Swagger specification is not JSON and the optional \"\n            errMsg += \"'pyyaml' module (needed for YAML specifications) is not available\"\n            raise ValueError(errMsg)\n        try:\n            return yaml.safe_load(content)\n        except Exception as ex:\n            raise ValueError(\"not valid JSON nor YAML (%s)\" % getSafeExString(ex))\n\ndef _resolve(spec, node, seen=None, depth=0):\n    seen = seen or set()\n    if isinstance(node, dict) and \"$ref\" in node:\n        ref = node[\"$ref\"]\n        if not isinstance(ref, six.string_types):         # malformed '$ref' (non-string) -> treat as no ref\n            return {}\n        if ref in seen or depth > MAX_REF_DEPTH:\n            return {}\n        if not ref.startswith(\"#/\"):\n            logger.warning(\"skipping external OpenAPI $ref '%s'\" % ref)\n            return {}\n        seen = seen | set([ref])\n        current = spec","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/parse/openapi.py#L19-L55","documentation":"Error \"the provided OpenAPI/Swagger specification is not JSON and the optional 'pyyaml' module (needed for YAML specifications) is not available\" thrown in sqlmapproject/sqlmap.","triggerScenarios":"Thrown at lib/parse/openapi.py:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}