
com.qdesrame.openapi.diff.compare.OAuthFlowsDiff Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-diff Show documentation
Show all versions of openapi-diff Show documentation
Utility for comparing two OpenAPI specifications.
package com.qdesrame.openapi.diff.compare;
import com.qdesrame.openapi.diff.model.ChangedOAuthFlows;
import io.swagger.v3.oas.models.security.OAuthFlows;
import java.util.Optional;
/**
* Created by adarsh.sharma on 12/01/18.
*/
public class OAuthFlowsDiff {
private OpenApiDiff openApiDiff;
public OAuthFlowsDiff(OpenApiDiff openApiDiff) {
this.openApiDiff = openApiDiff;
}
public Optional diff(OAuthFlows left, OAuthFlows right) {
ChangedOAuthFlows changedOAuthFlows = new ChangedOAuthFlows(left, right);
if (left != null && right != null) {
openApiDiff.getoAuthFlowDiff().diff(left.getImplicit(), right.getImplicit()).ifPresent(changedOAuthFlows::setChangedImplicitOAuthFlow);
openApiDiff.getoAuthFlowDiff().diff(left.getPassword(), right.getPassword()).ifPresent(changedOAuthFlows::setChangedPasswordOAuthFlow);
openApiDiff.getoAuthFlowDiff().diff(left.getClientCredentials(), right.getClientCredentials()).ifPresent(changedOAuthFlows::setChangedClientCredentialOAuthFlow);
openApiDiff.getoAuthFlowDiff().diff(left.getAuthorizationCode(), right.getAuthorizationCode()).ifPresent(changedOAuthFlows::setChangedAuthorizationCodeOAuthFlow);
}
return changedOAuthFlows.isDiff() ? Optional.of(changedOAuthFlows) : Optional.empty();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy