Skip to content

Commit

Permalink
0.4.0 - added tags for controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
mehillid committed Nov 20, 2024
1 parent 87a6b2f commit 59effee
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 25 deletions.
18 changes: 9 additions & 9 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Make sure you include the <a href="https://jitpack.io/">repository</a> as well.
<dependency>
<groupId>com.github.qlsolutions.JavalinFly</groupId>
<artifactId>javalinfly-core</artifactId>
<version>0.3.1</version>
<version>0.4.0</version>
</dependency>
```

Expand All @@ -37,7 +37,7 @@ Make sure you include the <a href="https://jitpack.io/">repository</a> as well.
<annotationProcessorPath>
<groupId>com.github.qlsolutions.JavalinFly</groupId>
<artifactId>javalinfly-core</artifactId>
<version>0.3.1</version>
<version>0.4.0</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
Expand All @@ -51,7 +51,7 @@ Make sure you include the <a href="https://jitpack.io/">repository</a> as well.
<dependency>
<groupId>com.github.qlsolutions.JavalinFly</groupId>
<artifactId>javalinfly-kotlin</artifactId>
<version>0.3.1</version>
<version>0.4.0</version>
</dependency>
```

Expand All @@ -69,20 +69,20 @@ Make sure you include the <a href="https://jitpack.io/">repository</a> as well.
- Dependency

```groovy
implementation 'com.github.qlsolutions.JavalinFly:javalinfly-core:0.3.1'
implementation 'com.github.qlsolutions.JavalinFly:javalinfly-core:0.4.0'
```

- Annotation processor

```groovy
annotationProcessor 'com.github.qlsolutions.JavalinFly:javalinfly-core:0.3.1'
annotationProcessor 'com.github.qlsolutions.JavalinFly:javalinfly-core:0.4.0'
```

- <details>
<summary>Optionally also the kotlin module</summary>

```groovy
implementation 'com.github.qlsolutions.JavalinFly:javalinfly-kotlin:0.3.1'
implementation 'com.github.qlsolutions.JavalinFly:javalinfly-kotlin:0.4.0'
```

</details>
Expand All @@ -93,19 +93,19 @@ Make sure you include the <a href="https://jitpack.io/">repository</a> as well.

- Dependency
```groovy
implementation("com.github.qlsolutions.JavalinFly:javalinfly-core:0.3.1")
implementation("com.github.qlsolutions.JavalinFly:javalinfly-core:0.4.0")
```

- Annotation processor
```groovy
annotationProcessor("com.github.qlsolutions.JavalinFly:javalinfly-core:0.3.1")
annotationProcessor("com.github.qlsolutions.JavalinFly:javalinfly-core:0.4.0")
```

- <details>
<summary>Optionally also the kotlin module</summary>

```groovy
implementation("com.github.qlsolutions.JavalinFly:javalinfly-kotlin:0.3.1")
implementation("com.github.qlsolutions.JavalinFly:javalinfly-kotlin:0.4.0")
```

</details>
Expand Down
2 changes: 1 addition & 1 deletion javalinfly-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.unldenis</groupId>
<artifactId>JavalinFly</artifactId>
<version>0.3.1</version>
<version>0.4.0</version>
</parent>

<artifactId>javalinfly-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@

boolean includeApi() default true;

String[] tags() default "";

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public void decodeSchemas(String schemasEncoded) {
schemas = JsonUtils.get().deserialize(schemasEncoded, typeRef);
}

public void addPath(String path, String method, String[] roles, String summary, boolean deprecated,
List<String> pathParameters, List<String> queryParameters, String[] pathTags,
public void addPath(String[] pathTags, String path, String method, String[] roles, String summary, boolean deprecated,
List<String> pathParameters, List<String> queryParameters,
@Nullable String bodySchema, @Nullable String responseOkSchema,
@Nullable String responseErrSchema, ResponseType responseType) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ protected void run() {
String responseType = null;
String[] handlerRoles;
String summary;
String[] handlerTags = null;
ResponseType handlerResponseType = null;
boolean deprecated;
if (get != null) {
Expand All @@ -129,31 +128,27 @@ protected void run() {
responseType = get.responseType().compiled();
handlerRoles = get.roles();
summary = get.summary();
handlerTags = get.tags();
deprecated = get.deprecated();
} else if (post != null) {
handlerType = "POST";
handlerResponseType = post.responseType();
responseType = post.responseType().compiled();
handlerRoles = post.roles();
summary = post.summary();
handlerTags = post.tags();
deprecated = post.deprecated();
} else if (put != null) {
handlerType = "PUT";
handlerResponseType = put.responseType();
responseType = put.responseType().compiled();
handlerRoles = put.roles();
summary = put.summary();
handlerTags = put.tags();
deprecated = put.deprecated();
} else if (delete != null) {
handlerType = "DELETE";
handlerResponseType = delete.responseType();
responseType = delete.responseType().compiled();
handlerRoles = delete.roles();
summary = delete.summary();
handlerTags = delete.tags();
deprecated = delete.deprecated();
} else {
continue;
Expand Down Expand Up @@ -440,7 +435,8 @@ protected void run() {
if (injector.generateDocumentation()) {
openApiStatements.add(
String.format(
" openApiTranslator.addPath(\"%s\", \"%s\", %s, \"%s\", %b, %s, %s, %s, %s, %s, %s, ResponseType.%s);\n",
" openApiTranslator.addPath(%s, \"%s\", \"%s\", %s, \"%s\", %b, %s, %s, %s, %s, %s, ResponseType.%s);\n",
StringUtils.arrayToJavaCode(controller.tags()),
endpointPath.toString(),
handlerType,
StringUtils.arrayToJavaCode(handlerRoles),
Expand All @@ -450,7 +446,6 @@ protected void run() {
: String.format("Arrays.asList(%s)", String.join(",", pathParameters)),
queryParameters.isEmpty() ? "Collections.emptyList()"
: String.format("Arrays.asList(%s)", String.join(",", queryParameters)),
StringUtils.arrayToJavaCode(handlerTags),
/*body*/ bodySchema == null ? null : "\"" + bodySchema + "\"",
/* ok */ returnOkSchema == null ? null : "\"" + returnOkSchema + "\"",
/* err */ returnErrSchema == null ? null : "\"" + returnErrSchema + "\"",
Expand Down
2 changes: 1 addition & 1 deletion javalinfly-example-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.unldenis</groupId>
<artifactId>JavalinFly</artifactId>
<version>0.3.1</version>
<version>0.4.0</version>
</parent>

<artifactId>javalinfly-example-kotlin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion javalinfly-example-kotlin/src/main/kotlin/Hello.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.quicklink.javalinfly.kotlin.successResponse
import com.quicklink.javalinfly.ResponseType
import io.javalin.http.Context

@Controller(path = "/hello")
@Controller(path = "/hello", tags = ["Hello"])
class Hello {
@Get(responseType = ResponseType.STRING, roles = ["USER", "ADMIN"], deprecated = true)
fun main(ctx: Context) = successResponse<String> {
Expand Down
2 changes: 1 addition & 1 deletion javalinfly-example-kotlin/src/main/kotlin/UserHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.quicklink.javalinfly.annotation.*
import com.quicklink.javalinfly.kotlin.response
import io.javalin.http.Context

@Controller(path = "/user")
@Controller(path = "/user", tags = ["User"])
class UserHandler {

@Post(tags = ["user"])
Expand Down
2 changes: 1 addition & 1 deletion javalinfly-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.unldenis</groupId>
<artifactId>JavalinFly</artifactId>
<version>0.3.1</version>
<version>0.4.0</version>
</parent>

<artifactId>javalinfly-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion javalinfly-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.unldenis</groupId>
<artifactId>JavalinFly</artifactId>
<version>0.3.1</version>
<version>0.4.0</version>
</parent>

<artifactId>javalinfly-kotlin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.unldenis</groupId>
<artifactId>JavalinFly</artifactId>
<version>0.3.1</version>
<version>0.4.0</version>
<packaging>pom</packaging>

<modules>
Expand Down

0 comments on commit 59effee

Please sign in to comment.