Allow Access to ListItem Properties via JSON-RPC
#15
Ok, so I've been looking at how things work in the sections linked above, and I found something peculiar. CFileItemHandler::GetField is where it appears that the JSON-RPC mechanism does the bulk of the work in "parsing" the directory it gets passed. There are a few instances where it handles properties that it finds in the request:
I should point out that the music- and TV-specific properties I'm referring to here are ListItem properties. However, last but not least, the final condition:
Which leads me to believe that any property which does not satisfy one of the preceding six conditions, would at least trigger a check, and attempt to append the value of that property to the response.

However, upon further investigation, and looking deeper into how JSON schemas and the JSON-RPC API work, I've found that it actually isn't allowed to send any additional properties. The documentation on the wiki indicates that "additionalProperties" are a supported feature of JSON schemas, and the default behavior, when additional properties are found in a schema, is actually to allow them (an empty schema, allowing any value). However, by the time that the JSON is parsed for properties, additional properties, and unique properties, there is something happening that triggers the message: Received value does not match any of the defined enum values.

It seems that by using an enum type in the schema, this method precludes itself from being able to accept additional properties... Which means this may be "as simple" as changing the schema to allow them in one way or another. This would ideally not affect any code that isn't already using them (since they can't), and wouldn't be a complexity concern, as the properties would only be queried when requested from the API.

So, a question for the more experienced developers that may have touched the API more in-depth than myself: Does this logic follow, or am I in a completely different field?
Reply


Messages In This Thread
RE: Allow Access to ListItem Properties via JSON-RPC - by drinfernoo - 2020-06-23, 20:50
Logout Mark Read Team Forum Stats Members Help
Allow Access to ListItem Properties via JSON-RPC0