Skip to content

Commit e0a0c7d

Browse files
committed
support helidon path pattern
1 parent b587709 commit e0a0c7d

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
on:
2+
workflow_dispatch:
3+
inputs:
4+
version:
5+
description: 'Version of the release'
6+
required: true
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up Java for publishing to Maven Central Repository
14+
uses: actions/setup-java@v1
15+
with:
16+
java-version: 11
17+
server-id: ossrh
18+
server-username: MAVEN_USERNAME
19+
server-password: MAVEN_PASSWORD
20+
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
21+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
22+
- name: build artifact
23+
run: mvn clean package
24+
env: #can maybe do something with this?
25+
VERSION: ${{ inputs.version }}
26+
- name: Create release
27+
uses: ncipollo/release-action@v1
28+
with:
29+
allowUpdates: true
30+
artifacts: "${{ github.workspace }}/target/*.jar"
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
- name: Publish to the Maven Central Repository
33+
run: |
34+
mvn \
35+
--no-transfer-progress \
36+
--batch-mode \
37+
deploy
38+
env:
39+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
40+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
41+
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

http-generator-core/src/main/java/io/avaje/http/generator/core/PathSegments.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public static class Segment {
164164
* Create a normal segment.
165165
*/
166166
Segment(String name) {
167-
this.name = name;
167+
this.name = name.startsWith("+") ? name.substring(1) : name.split(":")[0];
168168
this.sanitizedName = Util.sanitizeName(name);
169169
this.literalSection = null;
170170
this.matrixKeys = null;

http-generator-helidon/src/main/java/io/avaje/http/generator/helidon/nima/ControllerMethodWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void writeRule() {
9292
} else if (isFilter) {
9393
writer.append(" routing.addFilter(this::_%s);", method.simpleName()).eol();
9494
} else {
95-
writer.append(" routing.%s(\"%s\", this::_%s);", webMethod.name().toLowerCase(), method.fullPath(), method.simpleName()).eol();
95+
writer.append(" routing.%s(\"%s\", this::_%s);", webMethod.name().toLowerCase(), method.fullPath().replace("\\", "\\\\"), method.simpleName()).eol();
9696
}
9797
}
9898

tests/test-nima-jsonb/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@
3939
<classpathentry kind="src" path="target/generated-sources/annotations">
4040
<attributes>
4141
<attribute name="optional" value="true"/>
42+
<attribute name="maven.pomderived" value="true"/>
43+
<attribute name="ignore_optional_problems" value="true"/>
44+
<attribute name="m2e-apt" value="true"/>
4245
</attributes>
4346
</classpathentry>
4447
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
4548
<attributes>
4649
<attribute name="optional" value="true"/>
50+
<attribute name="maven.pomderived" value="true"/>
51+
<attribute name="ignore_optional_problems" value="true"/>
52+
<attribute name="m2e-apt" value="true"/>
4753
<attribute name="test" value="true"/>
4854
</attributes>
4955
</classpathentry>

tests/test-nima-jsonb/src/main/java/org/example/TestController.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,14 @@ String formBean(MyForm form) {
145145
String maybeNoContent(Boolean empty) {
146146
return Boolean.TRUE.equals(empty) ? null : "Hi";
147147
}
148+
149+
@Get("/peppermint/{patty:\\d+}")
150+
String pattern(String patty) {
151+
return patty.toString();
152+
}
153+
154+
@Get("/minus/{+plus}")
155+
String patternPlus(String plus) {
156+
return plus.toString();
157+
}
148158
}

0 commit comments

Comments
 (0)