mattermost-api-reference icon indicating copy to clipboard operation
mattermost-api-reference copied to clipboard

Help Wanted: User props is not fully described in API reference

Open vblz opened this issue 4 years ago • 7 comments

Everywhere in the API reference User Props is described as object. For instance https://api.mattermost.com/#operation/CreateUser . Regarding to https://www.json.org/json-en.html JSON object can have members of any JSON types.

But in official drivers the field props has type map[string]string https://github.com/mattermost/mattermost-server/blob/d1eeafb29ff822cf6d9850a5307ab37c61fbc445/model/user.go#L85 https://github.com/mattermost/mattermost-redux/blob/3d1028034d7677adfda58e91b9a5dcaf1bc0ff99/src/types/users.ts#L42

Proposal: In the API reference clearly specify that User Props can have members only of string type

vblz avatar Jun 04 '21 08:06 vblz

@mkraft - Would a member of your team be able to assist with this issue?

cwarnermm avatar Feb 25 '22 15:02 cwarnermm

@vblz The word "object" is actually correct in this case in that the required type is an object, an object that happens to have other constraints. Also the constraints are detailed within the API documentation.

Screen Shot 2022-03-08 at 4 56 11 PM .

mkraft avatar Mar 08 '22 21:03 mkraft

@mkraft I didn't mean whole object to pass, but only props field. image According to the code I linked above you can not pass such a valid JSON object there

...
 "props": {"a": 1, "b":["list", "example"]}
 ...

but there is no mention about this limitation in api documentation and only way to find it out is checking source code.

vblz avatar Mar 09 '22 07:03 vblz

@vblz Ah yes good point, props isn't well documented like notify_props is. Is this something you would be interested in submitting a pull request for? If not, no worries we can add it as a help wanted. Either way, thanks for identifying it.

mkraft avatar Mar 09 '22 14:03 mkraft

@mkraft it's better to add "help wanted" tag

vblz avatar Mar 10 '22 08:03 vblz

Copied the request to https://mattermost.atlassian.net/browse/MM-42462.

mkraft avatar Mar 10 '22 17:03 mkraft

I would like to work on this. @mkraft @cwarnermm Can you assign this to me?

1kjnv avatar Aug 24 '22 03:08 1kjnv