Skip to content

Commit 1624894

Browse files
devin-ai-integration[bot]fern-supportdvdaruri-art
authored
fix(openapi): collapse dotted operationIds into valid endpoint names (#17310)
* fix(openapi): collapse dotted operationIds into valid endpoint names Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(openapi): sanitize dotted method names after tokenization in v3 importer Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore(cli): call out method rename in changelog entry Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: dakshesh.daruri <support@buildwithfern.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Dak <dakshesh@buildwithfern.com>
1 parent 55cd3e8 commit 1624894

13 files changed

Lines changed: 4295 additions & 4 deletions

File tree

packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/AbstractOperationConverter.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,19 @@ export abstract class AbstractOperationConverter extends AbstractConverter<
332332
return operationId;
333333
}
334334

335+
// A dot in a method name is parsed as a reference to another file (`import.endpoint`),
336+
// so dotted operation ids must be collapsed into a single name. This runs after
337+
// tokenization so that grouping still sees the individual tokens.
338+
protected sanitizeMethodName(methodName: string): string {
339+
return methodName.includes(".") ? camelCase(methodName) : methodName;
340+
}
341+
335342
protected computeGroupNameFromTagAndOperationId(): GroupNameAndLocation {
336343
const tag = this.operation.tags?.[0];
337344
const methodName = this.evaluateMethodNameFromOperation();
338345

339346
if (tag == null) {
340-
return { method: methodName };
347+
return { method: this.sanitizeMethodName(methodName) };
341348
}
342349

343350
const tagTokens = tokenizeString(tag);
@@ -372,7 +379,7 @@ export abstract class AbstractOperationConverter extends AbstractConverter<
372379
if (tagIsNotPrefixOfMethodName) {
373380
return {
374381
group: [tag],
375-
method: methodName
382+
method: this.sanitizeMethodName(methodName)
376383
};
377384
}
378385

0 commit comments

Comments
 (0)