I couldn't immediately locate the code behind this because of the use of Ctools and the fact that the "Add" menu item at /admin/structure/services doesn't tell me I'm actually adding an endpoint. The problem is that form asks you for a name and simply says it's "The unique ID for this endpoint." I entered the name "Commerce API" and then got an error message telling me I can only use alphanumeric characters and underscores. The problem is this wasn't apparent on the form at all. I'd advise at least adding this information to the form element's #description, and if possible you might consider using a machine-name field instead of a regular textfield.
Comments
Comment #1
ygerasimov commentedGood valid advise. Ryan do you mean something like attached patch?
Comment #3
ygerasimov commented#1: services-1621512-machine-name-element-for-endpoint-name.patch queued for re-testing.
Comment #4
rszrama commentedAhh, yeah, I'll give it a shot. I didn't realize Ctools wasn't already using a machine-name element for that form item. Definitely the place to use it.
Comment #5
kylebrowning commentedThis looks fine but our test coverage for these validations does not exist, can we write tests for them?
Comment #6
ygerasimov commentedHere is patch with test for UI.
Comment #8
ygerasimov commentedOh. Form error message has been changed. Resubmitting the patch.
Comment #9
kylebrowning commentedAlso needs a backport!
Comment #10
marcingy commentedThis does not need to be a dynamic query just use a basic db_query I realise this is existing code but lets not keep what is unnecessary.
Again this query does not need to be dynamic
Comment #11
ygerasimov commentedI have changed patch according to marcingy comments on #10 and committed it. Commit 069324d
Comment #12
ygerasimov commentedCommitted to 6.x-3.x branch. Commit ca98d8e