PrefectHQ/prefect-ui-library

Bug: JSON input line errors don't match with the editor

znicholasbrown opened this issue · 1 comments

Using flow:

from typing import List
from prefect import flow


@flow
def json_input_bug(arr: List[str] = []):
  pass

if __name__ == '__main__':
    json_input_bug.serve(
       name='default',
    )

Steps to reproduce:

  • Run the above script (and so create a new deployment)
  • Navigate to the deployment page, click "Run" -> "Custom run"
  • Change the input for the arr property to JSON input
  • Enter the following into the editor and click "Run" (note the trailing comma, which is invalid JSON)
[
  "Hello World",
]

The following error will be displayed:
InvalidJSON() is not of type 'array' and Invalid JSON: Expecting value: line 3 column 1 (char 19)

Screenshot 2024-02-28 at 1 02 13 PM

which doesn't match what's in the editor

cc @pleek91

I took a quick look at this I think we can close it unless I'm misunderstanding.

The json that gets passed is "[\n \"Hello World\",\n]". The comma itself is not the cause of error, the error is that there is value expected after a comma. But where it expects a value it sees ], which is line 3 column 1.