Package org.codehaus.enunciate.contract.validation

Examples of org.codehaus.enunciate.contract.validation.ValidationResult.addError()


    ValidationResult result = new ValidationResult();

    if (webFault.isImplicitSchemaElement()) {
      String faultBeanFQN = webFault.getImplicitFaultBeanQualifiedName();
      if (!alreadyVisited.add(faultBeanFQN)) {
        result.addError(webFault, faultBeanFQN + " conflicts with another generated bean name.  Please use the @WebFault annotation " +
          "to customize the fault bean name.");
      }
    }

    return result;
View Full Code Here


      }

      for (ResourceMethod resourceMethod : rootResource.getResourceMethods(true)) {
        if ("/*".equals(resourceMethod.getServletPattern())) {
          if (!allowWildcardServlet) {
            result.addError(resourceMethod, "This JAX-RS resource method is designed to catch all requests (including requests to " +
              "Enunciate-generated documentation and other static files). If this is what you want, then please set 'disableWildcardServletError' to 'true'" +
              "in the Enunciate config for the Jersey module.  Otherwise, enable the rest subcontext or adjust the @Path annotation to be more specific.");
          }
          else {
            result.addWarning(resourceMethod, "JAX-RS resource method is designed to catch all requests.");
View Full Code Here

        for (String producesMime : resourceMethod.getProducesMime()) {
          try {
            MediaType.valueOf(producesMime);
          }
          catch (Exception e) {
            result.addError(resourceMethod, "Invalid produces MIME type: " + producesMime + "(" + e.getMessage() + ").");
          }
        }

        if (resourceMethod.getHttpMethods().size() > 1) {
          result.addError(resourceMethod, "You must not apply multiple HTTP operations to the same method: " + resourceMethod.getHttpMethods());
View Full Code Here

            result.addError(resourceMethod, "Invalid produces MIME type: " + producesMime + "(" + e.getMessage() + ").");
          }
        }

        if (resourceMethod.getHttpMethods().size() > 1) {
          result.addError(resourceMethod, "You must not apply multiple HTTP operations to the same method: " + resourceMethod.getHttpMethods());
        }

        for (String method : resourceMethod.getHttpMethods()) {
          if ("GET".equalsIgnoreCase(method) && (resourceMethod.getRepresentationMetadata() == null)) {
            result.addWarning(resourceMethod, "A resource method that is mapped to HTTP GET should probably have an output payload. (Does it return void?)");
View Full Code Here

          if ("GET".equalsIgnoreCase(method) && (resourceMethod.getRepresentationMetadata() == null)) {
            result.addWarning(resourceMethod, "A resource method that is mapped to HTTP GET should probably have an output payload. (Does it return void?)");
          }

          if ("GET".equalsIgnoreCase(method) && resourceMethod.getEntityParameter() != null) {
            result.addError(resourceMethod, "A resource method that is mapped to HTTP GET must not specify an entity parameter.");
          }
        }
      }
    }
View Full Code Here

      if (attribute.isXmlList()) {
        result.addWarning(attribute, "The C client code won't serialize xml lists as an array, instead passing the list as a string that will need to be parsed. This may cause confusion to C consumers.");
      }

      if (attribute.isCollectionType() && attribute.isBinaryData()) {
        result.addError(attribute, "The C client code doesn't support a collection of items that are binary data. You'll have to define separate accessors for each item or disable the C module.");
      }
    }

    if (complexType.getValue() != null) {
      if (complexType.getValue().isXmlList()) {
View Full Code Here

      if (complexType.getValue().isXmlList()) {
        result.addWarning(complexType.getValue(), "The C client code won't serialize xml lists as an array, instead passing the list as a string that will need to be parsed. This may cause confusion to C consumers.");
      }

      if (complexType.getValue().isCollectionType() && complexType.getValue().isBinaryData()) {
        result.addError(complexType.getValue(), "The C client code doesn't support a collection of items that are binary data. You'll have to define separate accessors for each item or disable the C module.");
      }
    }

    for (Element element : complexType.getElements()) {
      if (element.isXmlList()) {
View Full Code Here

      if (element.isXmlList()) {
        result.addWarning(element, "The C client code won't serialize xml lists as an array, instead passing the list as a string that will need to be parsed. This may cause confusion to C consumers.");
      }

      if (element.getAccessorType() instanceof MapType && !element.isAdapted()) {
        result.addError(element, "The C client doesn't have a built-in way of serializing a Map. So you're going to have to use @XmlJavaTypeAdapter to supply " +
          "your own adapter for the Map, or disable the C module.");
      }

      if (element.isCollectionType()) {
        if (element.getChoices().size() > 1) {
View Full Code Here

            "This makes the C API a bit awkward to use and makes it impossible to preserve the order of the collection. If order is relevant, consider breaking out " +
            "the choices into their own collection or otherwise refactoring the API.");
        }

        if (element.isBinaryData()) {
          result.addError(element, "The C client code doesn't support a collection of items that are binary data. You'll have to define separate accessors for each item or disable the C module.");
        }

        for (Element choice : element.getChoices()) {
          if (choice.isNillable()) {
            result.addWarning(choice, "The C client code doesn't support nillable items in a collection (the nil items will be skipped). This may cause confusion to C consumers.");
View Full Code Here

  @Override
  public ValidationResult validateComplexType(ComplexTypeDefinition complexType) {
    ValidationResult result = super.validateComplexType(complexType);
    if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) {
      result.addError(complexType, "Ruby requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.");
    }
    for (Element element : complexType.getElements()) {
      if (element instanceof ElementRef && ((ElementRef) element).isElementRefs()) {
        result.addWarning(complexType, "The Ruby client library doesn't fully support the @XmlElementRefs annotation. The items in the collection will be read-only and will only be available to Ruby clients in the form of a Hash. Consider redesigning using a collection of a single type. See http://jira.codehaus.org/browse/ENUNCIATE-542 for more information.");
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.