Skip to content

PointerToNowhere error when validating CRDs #216

Closed

Description

@Sanjay-2004

I have tried creating a schema and validating yaml file structures based on their datatype and I have been constantly getting the same error no matter how I try to resolve it.

The source code where I'm getting this error is here: Openapi_validation

Steps to Reproduce

  • Run pip install pyyaml openapi_schema_validator
  • Run python validate_crd.py valid_crd.yaml

Error Message:

❌ Validation Error: PointerToNowhere: '/components/schemas/CustomAttribute' does not exist within {'oneOf': [{'type': 'string', 'minLength': 0, 'maxLength': 100, 'default': '', 'pattern': '.*', 'description': 'A string value.'}, {'type': 'integer', 'minimum': 0, 'maximum': 100, 'default': 0, 'description': 'An integer value.'}, {'type': 'boolean', 'default': False, 'enum': [True, False], 'description': 'A boolean value.'}, {'type': 'array', 'items': {'oneOf': [{'type': 'string'}, {'type': 'integer'}, {'type': 'boolean'}, {'$ref': '#/components/schemas/CustomAttribute'}]}, 'default': [], 'description': 'An array of values.'}, {'type': 'object', 'properties': {'default': {'type': 'object'}, 'description': {'type': 'string'}, 'properties': {'type': 'object', 'additionalProperties': {'$ref': '#/components/schemas/CustomAttribute'}}}, 'required': ['default', 'description', 'properties']}]}

It would really help if there is any fix for this

Activity

  1. p1c2u commented on Feb 22, 2025

    @p1c2u
    Collaborator

    You need to pass registry with your references to validator be able to resolve pointers

    https://openapi-schema-validator.readthedocs.io/en/latest/references.html#references

  2. locked and limited conversation to collaborators on Feb 22, 2025
  3. converted this issue into a discussion #217 on Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions