line / line/centraldogma

Add useful factory methods to `PathPattern`

Open
#659 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue new feature
Dominant language
Java
Stars
668
Forks
135
Avg merge
4d 19h
Merged PRs (30d)
7

Description

`PathPattern` is introduced in #651 to create complex path patterns easily.
We will provide more common patterns as factory methods.
```java
// *.json
PathPattern.endsWith("json");
// /**/foo.txt
PathPattern.endsWith("foo.txt");

// /foo/bar/**
PathPattern.under("/foo/bar"); // or
PathPattern.startsWith("/foo/bar");

// Compose the existing path patterns
// /foo/bar/**/*.json
PathPattern.startsWith("/foo/bar").endsWith("json"); // or
PathPattern.builder()
.startsWith("/foo/bar")
.endsWith("json")
.build();

// *.json and /foo/bar/**
PathPattern.of(PatternPattern.of("json"), PathPattern.startsWith("/foo/bar"));
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the PathPattern implementation introduced in #651 and inspect its existing pattern-composition API. Add the requested factory methods and composition forms described in this issue, then verify that the listed path examples produce the intended matches; no tests or file paths are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.