I am using the discourse_api gem, and adding a group fails as follows:
client = DiscourseApi::Client.new
client.create_group(name: "some_group")
DiscourseApi::Error: {"errors"=>["Name must be at least 3 characters"]}
This is because of a mismatch between what the gem posts, and what the API expects.
The gem posts
{
"group": {
"name": "some_group",
"visible": "true"
}
}
But the controller method does not expect the root ‘group’ key:
group = Group.new
group.name = (params[:name] || '').strip
The discourse api documentation does not seem to mention groups: Discourse API Documentation
I am happy to fix this bug, but wanted to ask what we think the correct API design here is - should we fix it by removing the root element from the packet posted by the gem, or should the controller method be changed to deal with the root element?