We could download the OpenAPI JSON to a file `openapi.json` and then we could **remove that prefixed tag** with a script like this:
-```Python
-{!../../../docs_src/generate_clients/tutorial004.py!}
-```
+=== "Python"
+
+ ```Python
+ {!> ../../../docs_src/generate_clients/tutorial004.py!}
+ ```
+
+=== "Node.js"
+
+ ```Python
+ {!> ../../../docs_src/generate_clients/tutorial004.js!}
+ ```
With that, the operation IDs would be renamed from things like `items-get_items` to just `get_items`, that way the client generator can generate simpler method names.
--- /dev/null
+import * as fs from "fs";
+
+const filePath = "./openapi.json";
+
+fs.readFile(filePath, (err, data) => {
+ const openapiContent = JSON.parse(data);
+ if (err) throw err;
+
+ const paths = openapiContent.paths;
+
+ Object.keys(paths).forEach((pathKey) => {
+ const pathData = paths[pathKey];
+ Object.keys(pathData).forEach((method) => {
+ const operation = pathData[method];
+ if (operation.tags && operation.tags.length > 0) {
+ const tag = operation.tags[0];
+ const operationId = operation.operationId;
+ const toRemove = `${tag}-`;
+ if (operationId.startsWith(toRemove)) {
+ const newOperationId = operationId.substring(toRemove.length);
+ operation.operationId = newOperationId;
+ }
+ }
+ });
+ });
+ fs.writeFile(filePath, JSON.stringify(openapiContent, null, 2), (err) => {
+ if (err) throw err;
+ });
+});