Skip to content

Commit

Permalink
Merge pull request #72 from nextcloud/fix/remove-operation-id-renaming
Browse files Browse the repository at this point in the history
fix: Stop renaming parts of the operationId
  • Loading branch information
nickvergessen authored Jan 16, 2024
2 parents 59b4d32 + a4b872b commit 84c509c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
5 changes: 2 additions & 3 deletions generate-spec
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,7 @@ foreach ($routes as $route) {
);
}

$operationId = [$route->tag];
$operationId = array_merge($operationId, array_map(fn (string $s) => Helpers::mapVerb(strtolower($s)), Helpers::splitOnUppercaseFollowedByNonUppercase($route->methodName)));
$operationId = [$route->tag, ...Helpers::splitOnUppercaseFollowedByNonUppercase($route->methodName)];
if ($route->postfix != null) {
$operationId[] = $route->postfix;
}
Expand All @@ -605,7 +604,7 @@ foreach ($routes as $route) {
}

$operation = array_merge(
["operationId" => implode("-", $operationId)],
["operationId" => strtolower(implode("-", $operationId))],
$route->controllerMethod->summary != null ? ["summary" => $route->controllerMethod->summary] : [],
count($route->controllerMethod->description) > 0 ? ["description" => implode("\n", $route->controllerMethod->description)] : [],
$route->controllerMethod->isDeprecated ? ["deprecated" => true] : [],
Expand Down
7 changes: 0 additions & 7 deletions src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ public static function splitOnUppercaseFollowedByNonUppercase(string $str): arra
return preg_split('/(?=[A-Z][^A-Z])/', $str, -1, PREG_SPLIT_NO_EMPTY);
}

public static function mapVerb(string $verb): string {
return match ($verb) {
"index" => "list",
default => $verb,
};
}

public static function mergeSchemas(array $schemas): mixed {
if (!in_array(true, array_map(fn ($schema) => is_array($schema), $schemas))) {
$results = array_values(array_unique($schemas));
Expand Down

0 comments on commit 84c509c

Please sign in to comment.