Improve Conduit type handling for *.edit endpoints

Summary:
Ref T9964. Three goals here:

  - Make it easier to supply Conduit documentation.
  - Make automatic documentation for `*.edit` endpoints more complete, particularly for custom fields.
  - Allow type resolution via Conduit types, so you can pass `["alincoln"]` to "subscribers" instead of needing to use PHIDs.

Test Plan:
  - Viewed and used all search and edit endpoints, including custom fields.
  - Used parameter type resolution to set subscribers to user "dog" instead of "PHID-USER-whatever".
  - Viewed HTTP parameter documentation.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9964

Differential Revision: https://secure.phabricator.com/D14796
This commit is contained in:
epriestley
2015-12-16 05:09:21 -08:00
parent 1d72c97fc9
commit 161ebad56d
41 changed files with 510 additions and 191 deletions

View File

@@ -46,19 +46,27 @@ final class PhabricatorProjectsEditEngineExtension
->setKey('projectPHIDs')
->setLabel(pht('Projects'))
->setEditTypeKey('projects')
->setDescription(pht('Add or remove associated projects.'))
->setAliases(array('project', 'projects'))
->setIsCopyable(true)
->setUseEdgeTransactions(true)
->setEdgeTransactionDescriptions(
pht('Add projects.'),
pht('Remove projects.'),
pht('Set associated projects, overwriting current value.'))
->setCommentActionLabel(pht('Change Projects'))
->setDescription(pht('Select projects for the object.'))
->setTransactionType($edge_type)
->setMetadataValue('edge:type', $project_edge_type)
->setValue($project_phids);
$projects_field->setViewer($engine->getViewer());
$edit_add = $projects_field->getConduitEditType('projects.add')
->setConduitDescription(pht('Add projects.'));
$edit_set = $projects_field->getConduitEditType('projects.set')
->setConduitDescription(
pht('Set projects, overwriting current value.'));
$edit_rem = $projects_field->getConduitEditType('projects.remove')
->setConduitDescription(pht('Remove projects.'));
return array(
$projects_field,
);