Repository navigation
feat(link): name methods from operationId - #51
Open
dimitropoulos wants to merge 2 commits into
Open
dimitropoulos wants to merge 2 commits into
dimitropoulos wants to merge 2 commits into
Conversation
An operation or alias with both x-fern-sdk-group-name and x-fern-sdk-method-name, neither empty, is named by them. Otherwise its operationId names it as <group path>.<method name>, split at the last dot: pets.list is the method list in the group pets, and accounts.members.list is the method list in the group members inside accounts. An operationId with no dot, such as listPets, makes no method and is not an error. x-fern-ignore still leaves the operation out. A group or method name from an operationId with no letters or digits is an error naming the operation, and equal method names in a group are an error however the methods are named. An alias in x-forge-aliases is named by its own keys in the same way, and never by the operation's operationId. operationId is not an extension, so it is not in Method::extensions.
There was a problem hiding this comment.
🟢 Approval recommended
The implementation and regression coverage match the stated requirements, with no blocking issues identified; tests were inspected but not executed.
No open issues 🎉
What changed in this PR
Adds dotted operationId naming for methods and aliases, making Fern naming extensions optional and addressing #50.
Changes:
- Falls back to
operationIdwhile preserving Fern precedence and name validation. - Tests naming, aliases, ignored operations, invalid values, and duplicate names.
- Documents the naming rules and alias isolation.
| File | Description |
|---|---|
| tests/parse/methods.rs | Tests operation naming and validation. |
| tests/parse/aliases.rs | Tests alias naming and independence. |
| src/link/openapi.rs | Reads operationId for operations and aliases. |
| src/link.rs | Implements naming fallback and validation. |
| src/lib.rs | Documents method and group naming rules. |
Review effort: Balanced
commit: |
srikrsna
approved these changes
Oct 19, 2026
srikrsna
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, just one comment.
dimitropoulos
commented
Oct 19, 2026
srikrsna
approved these changes
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Methods can now be named from
operationId, with the Fern extensions as an optional way to name them.For each operation:
x-fern-sdk-group-nameandx-fern-sdk-method-name, neither empty, those name the method.operationIdis read as<group path>.<method name>, split at the last dot:pets.listis methodlistin grouppets, andaccounts.members.listis methodlistin groupmembersinsideaccounts.operationIdwith no dot, such aslistPets, makes no method and is not an error.x-fern-ignore: truestill leaves the operation out, however it is named.Only one of the two Fern extensions falls through to
operationId. Names fromoperationIdfollow the same rules as Fern ones:GET /a: operationId has a group name with no letters or digits(fora..b.list,.list)GET /a: operationId has a method name with no letters or digits(forpets.)operationIdAn
operationIdthat is not a string is a reading error, like other typed keys.Aliases
An alias in
x-forge-aliasesfollows the same rule using its own keys: both Fern extensions, or else its ownoperationId. An alias never takes the operation'soperationId.operationIdis not an extension, so it never shows up inMethod::extensions.Output change
Documents that already have dotted operationIds and no Fern extensions now produce methods for those operations.
Tests
New tests in
tests/parse/methods.rsandtests/parse/aliases.rscover: dotted and multi-level operationIds, dotless operationIds being ignored, Fern winning overoperationId, a single Fern field falling back,x-fern-ignorewith anoperationId, empty and symbol-only parts as errors, a non-stringoperationId, aliases named by their ownoperationId, aliases not inheriting the operation'soperationId, and duplicate names between Fern-named andoperationId-named methods.cargo test --locked --all-features,cargo fmt --checkand both clippy runs from thelintrecipe pass.Closes #50