private Descriptor buildRepresentationDescriptor(Class<?> type) {

    ResourceMetadata metadata = mappings.getMetadataFor(type);

    return descriptor()
        . //
        id(getRepresentationDescriptorId(metadata))
        . //
        href(entityLinks.linkFor(type).slash("schema").toString())
        . //
        doc(getDocFor(metadata.getItemResourceDescription()))
        . //
        descriptors(buildPropertyDescriptors(type, metadata.getItemResourceRel()))
        . //
        build();
  }
  /**
   * Creates the {@link Descriptor}s for pagination parameters.
   *
   * @param type
   * @return
   */
  private List<Descriptor> getPaginationDescriptors(Class<?> type, HttpMethod method) {

    RepositoryInformation information = repositories.getRepositoryInformationFor(type);

    if (!information.isPagingRepository() || !getType(method).equals(Type.SAFE)) {
      return Collections.emptyList();
    }

    Link linkToCollectionResource = entityLinks.linkToCollectionResource(type);
    List<TemplateVariable> variables = linkToCollectionResource.getVariables();
    List<Descriptor> descriptors = new ArrayList<Descriptor>(variables.size());

    ProjectionDefinitionConfiguration projectionConfiguration =
        configuration.projectionConfiguration();

    for (TemplateVariable variable : variables) {

      // Skip projection parameter
      if (projectionConfiguration.getParameterName().equals(variable.getName())) {
        continue;
      }

      ResourceDescription description =
          SimpleResourceDescription.defaultFor(variable.getDescription());

      descriptors.add( //
          descriptor()
              . //
              name(variable.getName())
              . //
              type(Type.SEMANTIC)
              . //
              doc(getDocFor(description))
              . //
              build());
    }

    return descriptors;
  }