Skip to content

problem with properties that declare an element beginning with an underscore (or a property named 'enum') #92

@zeteref

Description

@zeteref

Hi,

I was testing a jsonschema that can be simplified to:

{
    "type": "object",
    "properties": {
        "_actions": { "$ref": "#/components/schemas/Actions" }
    },
    "components": {
        "schemas": {
            "Actions": {
                "type": "object"
            }
        }
    }
}

Trying to generate validator for this schema results in:

lua: ./jsonschema/store.lua:77: attempt to index field 'base' (a nil value)
stack traceback:
        ./jsonschema/store.lua:77: in function 'resolve'
        ./jsonschema.lua:167: in function 'validator'
        ./jsonschema.lua:662: in function 'generate_validator'
        ./jsonschema.lua:173: in function 'validator'
        ./jsonschema.lua:1191: in function 'generate_main_validator_ctx'
        ./jsonschema.lua:1208: in function 'generate_validator'
        validate.lua:23: in main chunk
        [C]: in ?

which is because of this if condition here:

k:sub(1,1) ~= '_'

I cannot understand what is the purpose of this condition? I can try to fix it but i'm afraid to break something else that was supposed to be fixed by it...

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