-
Notifications
You must be signed in to change notification settings - Fork 89
CLOUDP-345026: Update the L1 generation tool to support x-xgen-operation-id-override #4233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if overrides := extractOverrides(operation.Extensions); overrides != nil { | ||
if overriddenOperationID, ok := overrides["operationId"].(string); ok && overriddenOperationID != "" { | ||
operationID = overriddenOperationID | ||
shortOperationID = "" |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
OperationID: `listIdentityProviders`, | ||
ShortOperationID: ``, | ||
Aliases: nil, |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 != "" { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Proposed changes
Jira ticket: CLOUDP-345026
contributing.md
Checklist
make fmt
and formatted my codeFurther comments