Skip to content

Conversation

Luke-Sanderson
Copy link
Collaborator

@Luke-Sanderson Luke-Sanderson commented Sep 24, 2025

Proposed changes

Jira ticket: CLOUDP-345026

  • Adds support for x-xgen-operation-id-override
  • Atlascli specific overrides take priority over x-xgen-operation-id-override
  • Flyby: Add instructions for making changes to the API Generator to contributing.md

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have updated test/README.md (if an e2e test has been added)
  • I have run make fmt and formatted my code

Further comments

@Luke-Sanderson Luke-Sanderson changed the title Cloudp 345026 CLOUDP-345026: Update the L1 generation tool to support x-xgen-operation-id-override Sep 25, 2025
@Luke-Sanderson Luke-Sanderson marked this pull request as ready for review September 25, 2025 11:29
@Luke-Sanderson Luke-Sanderson requested a review from a team as a code owner September 25, 2025 11:29
if overrides := extractOverrides(operation.Extensions); overrides != nil {
if overriddenOperationID, ok := overrides["operationId"].(string); ok && overriddenOperationID != "" {
operationID = overriddenOperationID
shortOperationID = ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Wondering could we just not set extensions.shortOperationID in func processShortOperationIDOverride instead of here since we are already doing some logic for if an atlasCLI opId override exists (referring to here)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this check due to it being a duplicate

Comment on lines +12509 to +12511
OperationID: `listIdentityProviders`,
ShortOperationID: ``,
Aliases: nil,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the spec needs to be updated. Looking at the latest openapi, "x-xgen-operation-id-override": "listIdentityProviders"
I expect here to see:

OperationID:      `listFederationSettingIdentityProviders `,
ShortOperationID: `listIdentityProviders`,
Aliases:          []string{`listFederationSettingIdentityProviders`},

(see this make command. This github workflow may also help)

Copy link
Collaborator Author

@Luke-Sanderson Luke-Sanderson Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be covered by CLOUDP-347637 (Failed github workflow run for context).

We might need to merge the other ticket in before this one?

operationID = overriddenOperationID
shortOperationID = ""
}
if shortOperationID != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this logic? Since we already to the same thing in cli/api?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not and I have now removed it

@Luke-Sanderson Luke-Sanderson changed the base branch from master to op-id-override-feature-branch October 6, 2025 08:47
@Luke-Sanderson Luke-Sanderson changed the base branch from op-id-override-feature-branch to master October 6, 2025 09:19
cveticm
cveticm previously approved these changes Oct 6, 2025
Copy link
Collaborator

@cveticm cveticm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the changes!

return nil, fmt.Errorf("failed to clean description: %w", err)
}

if overrides := extractOverrides(operation.Extensions); overrides != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[q] for my own understanding, we have removed operationId overrides officially in benefit of x-xgen-operation-id-override? I'm trying to understand if we haven't missed any overrides here that should've been translated to x-xgen-operation-id-override

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no mention of replacing the operationId override officially by x-xgen-operation-id-override in the TD so I think I removed this my mistake. Will add it back in

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but does it make sense to keep two types of overrides? I think my main concern is just making sure we're handling both if they exist, but we could look into how the overrides are being added at the moment and if we should rename them, or maybe, we don't even use them

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since both target the same field (operationID) one will override the other. From what I can see in the latest openapi spec, I don't think operationID override is used. It was appear as x-operationid right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting! I think this is the AtlasCLI framework for overrides, e.g. search for the openapi spec tests with x-xgen-atlascli. There is a different format there for different overrides. Perharps by keeping this here, the idea is that if we need to override via AtlasCLI we can, let's drop a comment here maybe capturing this behaviour in case we see this in the future?

Copy link
Collaborator Author

@Luke-Sanderson Luke-Sanderson Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes this is the x-xgen-atlascli one. I think I might have originally removed it because I thought it was duplicating the logic from here. Yes I agree there is a use case for this override for overriding the operationId only for atlascli and I think that this override should take priority.

I will add a comment to reflect this

@Luke-Sanderson Luke-Sanderson merged commit a844560 into master Oct 6, 2025
25 checks passed
@Luke-Sanderson Luke-Sanderson deleted the CLOUDP-345026 branch October 6, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants