-
Notifications
You must be signed in to change notification settings - Fork 7
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
CLOUDP-271223: Skip conflict when x-xgen-soa-migration is set #243
Conversation
pathDiff, _ = json.MarshalIndent(e.Diff.PathsDiff.Modified[e.Entry], "", " ") | ||
} | ||
|
||
return fmt.Sprintf("the path: %q is enabled for merge but it has a diff between the base and external spec. See the diff:\n%s", e.Entry, pathDiff) |
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.
could you also provide the two files involved in this mismatch? We have a ticket to improve the error message of a conflict to list also the files that are involved to help investigate the issue.
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.
let me do this in another task, so that we can update all the error outputs or else this will grow. maybe we can defer to the ticket you mentioned
external *load.SpecInfo | ||
config *diff.Config | ||
specDiff *diff.Diff | ||
noExtDiff NoExtensionDiff |
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.
The name NoExtensionDiff
gives fom granted a lot of context on how we use extensions in the spec. Main question from a person without context is what is the difference between specDiff *diff.Diff
and noExtDiff NoExtensionDiff
?
Question: can we have an interface that includes both specDiff *diff.Diff
and noExtDiff NoExtensionDiff
as they are both checking differences between specifications
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.
starting with decoupling specDiff since we already have an oasdiff result struct in #250
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.
updated!
return nil | ||
} | ||
|
||
// allowDocsDiff = true not supported |
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.
Could you update this comment to add more context: what is allowDocsDiff
?, why is not supported? what is the implication in this piece of code?
@@ -417,6 +483,27 @@ func (o OasDiff) areSchemaIdentical(name string) bool { | |||
return !ok | |||
} | |||
|
|||
// arePathsIdenticalWithExcludeExtensions checks if the paths are identical with the extensions excluded |
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.
could you provide an example of the extension in the comment?
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.
this runs oasdiff with an "ignore extensions" config, I've updated the comment
@@ -417,6 +483,27 @@ func (o OasDiff) areSchemaIdentical(name string) bool { | |||
return !ok | |||
} | |||
|
|||
// arePathsIdenticalWithExcludeExtensions checks if the paths are identical with the extensions excluded | |||
func (o OasDiff) arePathsIdenticalWithExcludeExtensions(name string) (bool, error) { |
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.
the code seems to be checking if the path are identical with and without extensions 🤔 is this correct? if yes , we should rename the function to reflect this logic
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.
no, it's excluding extensions from the diff since there will always be Extensions, will update!
Get: &openapi3.Operation{ | ||
Extensions: map[string]interface{}{ | ||
"x-xgen-soa-migration": map[string]interface{}{ | ||
"allowDocsDiff": "true", |
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.
if we have AllowDocsDiffNotSupportedError
, why allowDocsDiff can be set to true?
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 answer is the same as it's a separate ticket to support it (cause initially we were not going to support)
return operation.Extensions[extensionName] | ||
} | ||
|
||
func allOperationsAllowDocsDiff(basePath *openapi3.PathItem) bool { |
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.
all of these functions seem to share the logic to check for something in each resource operation. Could you just have a function that runs multiple checks for each operation?
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.
can cover as a follow up as we have many other places in the code where we perform checks for each operation
Co-authored-by: Andrea Angiolillo <[email protected]>
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 all the clarifications!
Proposed changes
Jira ticket: CLOUDP-271223
No doc diff + duplicated path
Doc diff + duplicated path
Checklist
Further comments