test_class.file: conjure-core/src/test/java/com/palantir/conjure/defs/validator/HttpPathValidatorTest.java
test_class.identifier: HttpPathValidatorTest
test_case.body: @Test
      public void testValidPaths() {
          validate("/");
          validate("/a/b/c");
          validate("/abc");
          validate("/{foo}");
          validate("/abc/{foo}/bar");
          validate("/abc/{foo:.+}");
          validate("/abc/v1.2/{foo}");
      }
test_case.class_method_signature: HttpPathValidatorTest.testValidPaths()
test_case.full_signature: @Test public void testValidPaths()
test_case.identifier: testValidPaths
test_case.invocations: validate validate validate validate validate validate validate
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidPaths()
focal_class.declarator: PATTERN = "[a-z][a-z0-9]*([A-Z0-9][a-z0-9]+)*"
focal_class.modifier: public static final
focal_class.original_string: public static final String PATTERN = "[a-z][a-z0-9]*([A-Z0-9][a-z0-9]+)*";
focal_class.type: String
focal_class.var_name: PATTERN
focal_class.declarator: SEGMENT_PATTERN = Pattern.compile("^[a-zA-Z][a-zA-Z0-9._-]*$")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern SEGMENT_PATTERN = Pattern.compile("^[a-zA-Z][a-zA-Z0-9._-]*$");
focal_class.type: Pattern
focal_class.var_name: SEGMENT_PATTERN
focal_class.declarator: PARAM_SEGMENT_PATTERN = Pattern.compile("^\\{" + PATTERN + "}$")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern PARAM_SEGMENT_PATTERN = Pattern.compile("^\\{" + PATTERN + "}$");
focal_class.type: Pattern
focal_class.var_name: PARAM_SEGMENT_PATTERN
focal_class.declarator: PARAM_REGEX_SEGMENT_PATTERN =
              Pattern.compile("^\\{" + PATTERN + "(" + Pattern.quote(":.+") + "|" + Pattern.quote(":.*") + ")" + "}$")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern PARAM_REGEX_SEGMENT_PATTERN =
              Pattern.compile("^\\{" + PATTERN + "(" + Pattern.quote(":.+") + "|" + Pattern.quote(":.*") + ")" + "}$");
focal_class.type: Pattern
focal_class.var_name: PARAM_REGEX_SEGMENT_PATTERN
focal_class.file: conjure-core/src/main/java/com/palantir/conjure/defs/validator/HttpPathValidator.java
focal_class.identifier: HttpPathValidator
focal_class.class_method_signature: HttpPathValidator.HttpPathValidator()
focal_class.full_signature: private  HttpPathValidator()
focal_class.identifier: HttpPathValidator
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  HttpPathValidator()
focal_class.class_method_signature: HttpPathValidator.pathArgs(String httpPath)
focal_class.full_signature: public static Set<ArgumentName> pathArgs(String httpPath)
focal_class.identifier: pathArgs
focal_class.modifiers: public static
focal_class.parameters: (String httpPath)
focal_class.return: Set<ArgumentName>
focal_class.signature: Set<ArgumentName> pathArgs(String httpPath)
focal_class.class_method_signature: HttpPathValidator.validate(HttpPath httpPath)
focal_class.full_signature: public static void validate(HttpPath httpPath)
focal_class.identifier: validate
focal_class.modifiers: public static
focal_class.parameters: (HttpPath httpPath)
focal_class.return: void
focal_class.signature: void validate(HttpPath httpPath)
focal_class.class_method_signature: HttpPathValidator.withoutLeadingSlash(String httpPath)
focal_class.full_signature: public static String withoutLeadingSlash(String httpPath)
focal_class.identifier: withoutLeadingSlash
focal_class.modifiers: public static
focal_class.parameters: (String httpPath)
focal_class.return: String
focal_class.signature: String withoutLeadingSlash(String httpPath)
focal_method.body: public static void validate(HttpPath httpPath) {
          Path path = Paths.get(httpPath.get());
          Preconditions.checkArgument(
                  path.isAbsolute(), "Conjure paths must be absolute, i.e., start with '/': %s", path);
          Preconditions.checkArgument(
                  path.getSegments().isEmpty() || !path.isFolder(), "Conjure paths must not end with a '/': %s", path);
  
          for (String segment : path.getSegments()) {
              Preconditions.checkArgument(
                      SEGMENT_PATTERN.matcher(segment).matches()
                              || PARAM_SEGMENT_PATTERN.matcher(segment).matches()
                              || PARAM_REGEX_SEGMENT_PATTERN.matcher(segment).matches(),
                      "Segment %s of path %s did not match required segment patterns %s or parameter name "
                              + "patterns %s or %s",
                      segment,
                      path,
                      SEGMENT_PATTERN,
                      PARAM_SEGMENT_PATTERN,
                      PARAM_REGEX_SEGMENT_PATTERN);
          }
  
          // verify that path template variables are unique
          Set<String> templateVars = new HashSet<>();
          new UriTemplate(path.toString()).getTemplateVariables().forEach(var -> {
              Preconditions.checkState(
                      !templateVars.contains(var), "Path parameter %s appears more than once in path %s", var, path);
              templateVars.add(var);
          });
  
          UriTemplateParser uriTemplateParser = new UriTemplateParser(path.toString());
          Map<String, Pattern> nameToPattern = uriTemplateParser.getNameToPattern();
          List<String> segments = Splitter.on('/').splitToList(uriTemplateParser.getNormalizedTemplate());
          for (int i = 0; i < segments.size(); i++) {
              String segment = segments.get(i);
              if (!(segment.startsWith("{") && segment.endsWith("}"))) {
                  // path literal
                  continue;
              }
  
              // variable
              Pattern varPattern = nameToPattern.get(segment.substring(1, segment.length() - 1));
              if (varPattern.equals(UriTemplateParser.TEMPLATE_VALUE_PATTERN)) {
                  // no regular expression specified -- OK
                  continue;
              }
  
              // if regular expression was specified, it must be ".+" or ".*" based on invariant previously enforced
              Preconditions.checkState(
                      i == segments.size() - 1 || !varPattern.pattern().equals(".*"),
                      "Path parameter %s in path %s specifies regular expression %s, but this regular "
                              + "expression is only permitted if the path parameter is the last segment",
                      segment,
                      path,
                      varPattern);
          }
      }
focal_method.class_method_signature: HttpPathValidator.validate(HttpPath httpPath)
focal_method.full_signature: public static void validate(HttpPath httpPath)
focal_method.identifier: validate
focal_method.invocations: get get checkArgument isAbsolute checkArgument isEmpty getSegments isFolder getSegments checkArgument matches matcher matches matcher matches matcher forEach getTemplateVariables toString checkState contains add toString getNameToPattern splitToList on getNormalizedTemplate size get startsWith endsWith get substring length equals checkState size equals pattern
focal_method.modifiers: public static
focal_method.parameters: (HttpPath httpPath)
focal_method.return: void
focal_method.signature: void validate(HttpPath httpPath)