Skip to content

Commit

Permalink
SWITCHYARD-2972 - removing validation error for rest bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
bfitzpat committed Nov 11, 2016
1 parent ffe6107 commit 09706ca
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -37,6 +37,7 @@
import org.switchyard.ExchangePattern;
import org.switchyard.metadata.ServiceInterface;
import org.switchyard.metadata.ServiceOperation;
import org.switchyard.tools.models.switchyard1_0.resteasy.RESTBindingType;
import org.switchyard.tools.models.switchyard1_0.switchyard.StaticOperationSelectorType;
import org.switchyard.transform.TransformSequence;

Expand Down Expand Up @@ -147,20 +148,23 @@ private IStatus validateBindingOperationSelection(IValidationContext ctx, Contra
// reference binding - FUSETOOLS-1927
boolean isSCABinding = binding instanceof SCABinding;

// is handled differently and the NoBindingOperationSelected error is invalid.
boolean isRestBinding = binding instanceof RESTBindingType;

if (binding.getOperationSelector() != null
&& binding.getOperationSelector() instanceof StaticOperationSelectorType) {
StaticOperationSelectorType staticOpSelector =
(StaticOperationSelectorType) binding.getOperationSelector();

// if it already specifies which one, then we're good to go, otherwise...
if (staticOpSelector.getOperationName() == null && hasMoreThanOneOperation) {
if (staticOpSelector.getOperationName() == null && hasMoreThanOneOperation && !isRestBinding) {
// the user needs to specify the operation name when there is more than
// one operation in a Java interface
final ValidationProblem problem = ValidationProblem.NoBindingOperationSelected;
return ConstraintStatus.createStatus(ctx, contract, null, problem.getSeverity(), problem.ordinal(),
problem.getMessage(), contract.getName(), binding.getName());
}
} else if (binding.getOperationSelector() == null && hasMoreThanOneOperation && !isSCABinding) {
} else if (binding.getOperationSelector() == null && hasMoreThanOneOperation && !isSCABinding && !isRestBinding) {
// if there is no operation selector specified and the interface specifies two or more operations,
// and it's not an SCA binding, we have a problem (FUSETOOLS-1927)
final ValidationProblem problem = ValidationProblem.NoBindingOperationSelected;
Expand Down

0 comments on commit 09706ca

Please sign in to comment.