Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursion error #14

Open
misja opened this issue Jan 23, 2016 · 0 comments
Open

Recursion error #14

misja opened this issue Jan 23, 2016 · 0 comments

Comments

@misja
Copy link
Contributor

misja commented Jan 23, 2016

I was looking at validating hyper-schema documents and figured I could use the draft4 compiler since hyper-schema is just an extension. It fails however, with a maximum recursion depth exceeded error, this was my approach for a simple test -

from jsonspec.validators import load, Factory
from jsonspec.reference.providers import SpecProvider

data = {
    "$schema": "http://json-schema.org/draft-04/hyper-schema#",
    "id": "http://my.com/customer#",
    "type": "object",
    "properties": {
        "name": {
            "description": "Name of the customer",
            "type": "string",
            "pattern": "[a-zA-Z\\s]+"
        }
    },
    "required": ["name"],
    "links": [
        {
            "title": "Create",
            "description": "Create a customer.",
            "href": "/customers",
            "method": "POST",
            "rel": "create",
            "schema": {
                "$ref": "#"
            },
            "targetSchema": {
                "$ref": "#"
            }
        }
    ]
}

Factory.compilers['http://json-schema.org/draft-04/hyper-schema#'] = \
    Factory.compilers['http://json-schema.org/draft-04/schema#']

provider = SpecProvider()
validator = load(provider['draft-04/hyper-schema'], provider=provider)

validator.validate(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant