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

Conside using JsonPath for defining fiile field path. #61

Closed
rossoha opened this issue Jan 30, 2022 · 2 comments
Closed

Conside using JsonPath for defining fiile field path. #61

rossoha opened this issue Jan 30, 2022 · 2 comments

Comments

@rossoha
Copy link

rossoha commented Jan 30, 2022

From my understanding field path for the case when we have an array of files:

"SomeStructure":  {
"files" : ["file0", "file1"] 
}

will look like this:
variables.SomeStructure.files.0 and variables.SomeStructure.files.1

Why not consider using JsonPath for field path definition? Cause at the moment we can have a situation when fields name that represents file can be literal or a number in resulting JSON with the same behavior as an array.
Switching to JsonPath would slightly change path definition, but it would be parsable out of the box:
variables.SomeStructure.files.[0] and variables.SomeStructure.files.[1]

Thank you @jaydenseric.
Look forward to your response.

@jaydenseric
Copy link
Owner

jaydenseric commented Jan 31, 2022

What is “JsonPath” that you are referring to, is there a specification for it? Note that we already have this issue about adopting a proper path standard: #56 , which seems different to your proposal.

I'm not following your practical motivations for preferring .[0] vs .0 in the path string, what problems would it solve? Currently plenty of servers and clients with all sorts environments and languages using the current version of this spec are able to upload files held in arrays just fine.

If you want to put uploads in an object under string keys that are numbers, e.g. { "1": file, "2": file } I'm pretty sure it would work with the current spec, although I haven't personally done that before. The files are replaced with null in the variables JSON that is sent to the server, so the structure if it's an object with keys, or an array with items, is preserved. A sever implementation can see which type it is before populating the uploads back into their places.

@jaydenseric
Copy link
Owner

Closing as per the above comment.

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

2 participants