1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-07 12:28:28 +01:00

Mark "v3" API methods as stable; mark obsoleted methods as "Frozen"

Summary:
Ref T12074. The "v3" API methods (`*.search`, `*.edit`) are currently marked as "unstable", but they're pretty stable and essentially all new code should be using them.

Although these methods are seeing some changes, almost all changes are additive (support for new constraints or attachemnts) and do not break backward compatibility. We have no major, compatibility-breaking changes planned.

I don't want to mark the older methods "deprecated" yet since `arc` still uses a lot of them and there are some capabilities not yet available on the v3 methods, but introduce a new "frozen" status with pointers to the new methods.

Overall, this should gently push users toward the newer methods.

Test Plan: {F2325323}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12074

Differential Revision: https://secure.phabricator.com/D17158
This commit is contained in:
epriestley 2017-01-08 12:54:39 -08:00
parent 63bfa5ccb5
commit aa6e788f36
21 changed files with 161 additions and 28 deletions

View file

@ -128,6 +128,13 @@ final class PhabricatorConduitConsoleController
$stability_label = pht('Deprecated Method'); $stability_label = pht('Deprecated Method');
$stability_info = nonempty($reason, pht('This method is deprecated.')); $stability_info = nonempty($reason, pht('This method is deprecated.'));
break; break;
case ConduitAPIMethod::METHOD_STATUS_FROZEN:
$stability_icon = 'fa-archive grey';
$stability_label = pht('Frozen Method');
$stability_info = nonempty(
$reason,
pht('This method is frozen and will eventually be deprecated.'));
break;
default: default:
$stability_label = null; $stability_label = null;
break; break;

View file

@ -14,6 +14,7 @@ abstract class ConduitAPIMethod
const METHOD_STATUS_STABLE = 'stable'; const METHOD_STATUS_STABLE = 'stable';
const METHOD_STATUS_UNSTABLE = 'unstable'; const METHOD_STATUS_UNSTABLE = 'unstable';
const METHOD_STATUS_DEPRECATED = 'deprecated'; const METHOD_STATUS_DEPRECATED = 'deprecated';
const METHOD_STATUS_FROZEN = 'frozen';
const SCOPE_NEVER = 'scope.never'; const SCOPE_NEVER = 'scope.never';
const SCOPE_ALWAYS = 'scope.always'; const SCOPE_ALWAYS = 'scope.always';

View file

@ -67,6 +67,7 @@ final class PhabricatorConduitMethodQuery
$status = array( $status = array(
ConduitAPIMethod::METHOD_STATUS_STABLE => $this->isStable, ConduitAPIMethod::METHOD_STATUS_STABLE => $this->isStable,
ConduitAPIMethod::METHOD_STATUS_FROZEN => $this->isStable,
ConduitAPIMethod::METHOD_STATUS_DEPRECATED => $this->isDeprecated, ConduitAPIMethod::METHOD_STATUS_DEPRECATED => $this->isDeprecated,
ConduitAPIMethod::METHOD_STATUS_UNSTABLE => $this->isUnstable, ConduitAPIMethod::METHOD_STATUS_UNSTABLE => $this->isUnstable,
); );

View file

@ -166,6 +166,10 @@ final class PhabricatorConduitSearchEngine
$item->addIcon('fa-warning', pht('Deprecated')); $item->addIcon('fa-warning', pht('Deprecated'));
$item->setStatusIcon('fa-warning red'); $item->setStatusIcon('fa-warning red');
break; break;
case ConduitAPIMethod::METHOD_STATUS_FROZEN:
$item->addIcon('fa-archive', pht('Frozen'));
$item->setStatusIcon('fa-archive grey');
break;
} }
$list->addItem($item); $list->addItem($item);

View file

@ -11,6 +11,16 @@ final class DifferentialCloseConduitAPIMethod
return pht('Close a Differential revision.'); return pht('Close a Differential revision.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.edit" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'revisionID' => 'required int', 'revisionID' => 'required int',

View file

@ -11,6 +11,16 @@ final class DifferentialCreateCommentConduitAPIMethod
return pht('Add a comment to a Differential revision.'); return pht('Add a comment to a Differential revision.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.edit" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'revision_id' => 'required revisionid', 'revision_id' => 'required revisionid',

View file

@ -11,6 +11,16 @@ final class DifferentialCreateRevisionConduitAPIMethod
return pht('Create a new Differential revision.'); return pht('Create a new Differential revision.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.edit" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
// TODO: Arcanist passes this; prevent fatals after D4191 until Conduit // TODO: Arcanist passes this; prevent fatals after D4191 until Conduit

View file

@ -11,6 +11,16 @@ final class DifferentialQueryConduitAPIMethod
return pht('Query Differential revisions which match certain criteria.'); return pht('Query Differential revisions which match certain criteria.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.search" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
$hash_types = ArcanistDifferentialRevisionHash::getTypes(); $hash_types = ArcanistDifferentialRevisionHash::getTypes();
$hash_const = $this->formatStringConstants($hash_types); $hash_const = $this->formatStringConstants($hash_types);

View file

@ -11,6 +11,16 @@ final class DifferentialUpdateRevisionConduitAPIMethod
return pht('Update a Differential revision.'); return pht('Update a Differential revision.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "differential.revision.edit" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'id' => 'required revisionid', 'id' => 'required revisionid',

View file

@ -11,6 +11,16 @@ final class ManiphestCreateTaskConduitAPIMethod
return pht('Create a new Maniphest task.'); return pht('Create a new Maniphest task.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "maniphest.edit" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return $this->getTaskFields($is_new = true); return $this->getTaskFields($is_new = true);
} }

View file

@ -10,6 +10,16 @@ final class ManiphestInfoConduitAPIMethod extends ManiphestConduitAPIMethod {
return pht('Retrieve information about a Maniphest task, given its ID.'); return pht('Retrieve information about a Maniphest task, given its ID.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "maniphest.search" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'task_id' => 'required id', 'task_id' => 'required id',

View file

@ -10,6 +10,16 @@ final class ManiphestQueryConduitAPIMethod extends ManiphestConduitAPIMethod {
return pht('Execute complex searches for Maniphest tasks.'); return pht('Execute complex searches for Maniphest tasks.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "maniphest.search" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
$statuses = array( $statuses = array(
ManiphestTaskQuery::STATUS_ANY, ManiphestTaskQuery::STATUS_ANY,

View file

@ -10,6 +10,16 @@ final class ManiphestUpdateConduitAPIMethod extends ManiphestConduitAPIMethod {
return pht('Update an existing Maniphest task.'); return pht('Update an existing Maniphest task.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "maniphest.edit" instead.');
}
protected function defineErrorTypes() { protected function defineErrorTypes() {
return array( return array(
'ERR-BAD-TASK' => pht('No such Maniphest task exists.'), 'ERR-BAD-TASK' => pht('No such Maniphest task exists.'),

View file

@ -10,6 +10,16 @@ final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod {
return pht('Create a new paste.'); return pht('Create a new paste.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "paste.edit" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'content' => 'required string', 'content' => 'required string',

View file

@ -10,6 +10,16 @@ final class PasteQueryConduitAPIMethod extends PasteConduitAPIMethod {
return pht('Query Pastes.'); return pht('Query Pastes.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "paste.search" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'ids' => 'optional list<int>', 'ids' => 'optional list<int>',

View file

@ -10,6 +10,16 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod {
return pht('Query users.'); return pht('Query users.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "user.search" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'usernames' => 'optional list<string>', 'usernames' => 'optional list<string>',

View file

@ -10,6 +10,16 @@ final class ProjectCreateConduitAPIMethod extends ProjectConduitAPIMethod {
return pht('Create a project.'); return pht('Create a project.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "project.edit" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
return array( return array(
'name' => 'required string', 'name' => 'required string',

View file

@ -10,6 +10,16 @@ final class ProjectQueryConduitAPIMethod extends ProjectConduitAPIMethod {
return pht('Execute searches for Projects.'); return pht('Execute searches for Projects.');
} }
public function getMethodStatus() {
return self::METHOD_STATUS_FROZEN;
}
public function getMethodStatusDescription() {
return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "project.search" instead.');
}
protected function defineParamTypes() { protected function defineParamTypes() {
$statuses = array( $statuses = array(

View file

@ -8,11 +8,13 @@ final class RepositoryQueryConduitAPIMethod
} }
public function getMethodStatus() { public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE; return self::METHOD_STATUS_FROZEN;
} }
public function getMethodStatusDescription() { public function getMethodStatusDescription() {
return pht('Repository methods are new and subject to change.'); return pht(
'This method is frozen and will eventually be deprecated. New code '.
'should use "diffusion.repository.query" instead.');
} }
public function getMethodDescription() { public function getMethodDescription() {

View file

@ -32,17 +32,6 @@ abstract class PhabricatorSearchEngineAPIMethod
return PhabricatorApplication::getByClass($class); return PhabricatorApplication::getByClass($class);
} }
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
public function getMethodStatusDescription() {
return pht(
'ApplicationSearch methods are fairly stable, but were introduced '.
'relatively recently and may continue to evolve as more applications '.
'adopt them.');
}
final protected function defineParamTypes() { final protected function defineParamTypes() {
return array( return array(
'queryKey' => 'optional string', 'queryKey' => 'optional string',

View file

@ -11,17 +11,6 @@ abstract class PhabricatorEditEngineAPIMethod
return PhabricatorApplication::getByClass($class); return PhabricatorApplication::getByClass($class);
} }
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
public function getMethodStatusDescription() {
return pht(
'ApplicationEditor methods are fairly stable, but were introduced '.
'relatively recently and may continue to evolve as more applications '.
'adopt them.');
}
final protected function defineParamTypes() { final protected function defineParamTypes() {
return array( return array(
'transactions' => 'list<map<string, wild>>', 'transactions' => 'list<map<string, wild>>',