Skip to content

Error when using VM #239

@flyerH

Description

@flyerH

Describe the bug

JSONPath fails in VM mode (eval: 'safe') but works in native mode.

Code sample or steps to reproduce

$..parameters..[?(@property !== 'properties' && @.example !== void 0 && (@.type || @.format || @.$ref || @.properties || @.items))]
{
    "components": {
        "schemas": {
            "QueryCallbackResponse": {
                "properties": {
                    "num_out": {
                        "description": "description",
                        "example": 123123123,
                        "format": "int32",
                        "title": "title",
                        "type": "integer"
                    }
                },
                "type": "object"
            }
        }
    },
    "openapi": "3.0.0",
    "paths": {
        "/brand/sample/querycallback": {
            "get": {
                "description": "description",
                "operationId": "CallbackTesting",
                "parameters": [
                    {
                        "description": "description",
                        "in": "query",
                        "name": "num_in",
                        "required": false,
                        "schema": {
                            "description": "description",
                            "example": 123123123123,
                            "format": "int32",
                            "title": "title",
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/QueryCallbackResponse"
                                }
                            }
                        },
                        "description": "description"
                    }
                }
            }
        }
    }
}

Console error or logs

Figure 1: JSONPath failure under VM (eval: 'safe')
Image

Figure 2: Expected JSONPath result in native mode
Image

Expected behavior

Expected result

[
  {
    "description": "description",
    "example": 123123123123,
    "format": "int32",
    "title": "title",
    "type": "integer"
  }
]

Environment (IMPORTANT)

  • JSONPath-Plus version: 10.3.0

Desktop**

  • OS: Linux
  • Browser and version: Node.js 20

Additional context

This behavior started occurring after upgrading to v10. No issues before v10.
From the changelog, I think the VM changes broke this.
Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions