Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 91841ee

Browse files
author
hiwayama
committed
fixed config for uploaded maven repository
1 parent 710df1a commit 91841ee

File tree

3 files changed

+117
-33
lines changed

3 files changed

+117
-33
lines changed

build.gradle

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,84 @@
1-
import io.franzbecker.gradle.lombok.task.DelombokTask
2-
31
plugins {
42
id 'java'
5-
id 'io.franzbecker.gradle-lombok' version '1.14'
3+
id 'maven'
4+
id 'signing'
65
}
76

7+
archivesBaseName = "jsonrpc4j-jsonSchema"
8+
description 'This module is jackson-module-jsonschema wrapper for the creation of api document (like JSON-Schema) from POJO of jsonrpc4j service classes.'
89
group 'com.github.hiwayama'
9-
version '0.1-SNAPSHOT'
10+
version '0.2-alpha-1'
1011

1112
sourceCompatibility = 1.8
1213

13-
repositories {
14-
mavenCentral()
14+
// zip sources
15+
task sourceJar(type : Jar) {
16+
from sourceSets.main.allJava
1517
}
18+
// zip javadocs
19+
task javadocJar(type : Jar, dependsOn : javadoc) {
20+
from javadoc.destinationDir
21+
}
22+
23+
artifacts {
24+
archives javadocJar, sourceJar
25+
}
26+
27+
signing {
28+
sign configurations.archives
29+
}
30+
31+
uploadArchives {
32+
repositories {
33+
mavenDeployer {
34+
def ossuname = project.hasProperty("ossrhUsername") ? project.property("ossrhUsername") : ""
35+
def osspass = project.hasProperty("ossrhPassword") ? project.property("ossrhPassword") : ""
1636

17-
task delombok(type: DelombokTask, dependsOn: compileJava) {
18-
ext.outputDir = file("$buildDir/delombok")
19-
outputs.dir(outputDir)
20-
sourceSets.main.java.srcDirs.each {
21-
inputs.dir(it)
22-
args(it, "-d", outputDir)
37+
38+
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
39+
40+
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
41+
authentication(userName: ossuname, password: osspass)
42+
}
43+
44+
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
45+
authentication(userName: ossuname, password: osspass)
46+
}
47+
48+
pom.project {
49+
name project.name
50+
packaging 'jar'
51+
description project.description
52+
url 'https://github.com/hiwayama/jsonrpc-jsonSchema'
53+
54+
scm {
55+
url 'https://github.com/hiwayama/jsonrpc-jsonSchema'
56+
}
57+
58+
licenses {
59+
license {
60+
name 'The Apache License, Version 2.0'
61+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
62+
}
63+
}
64+
65+
developers {
66+
developer {
67+
name 'Hiromasa IWAYAMA'
68+
email 'iwayma1880@gmail.com'
69+
}
70+
}
71+
}
72+
}
2373
}
2474
}
2575

26-
javadoc {
27-
dependsOn delombok
28-
source = delombok.outputDir
29-
failOnError = false
76+
repositories {
77+
mavenCentral()
3078
}
3179

3280
dependencies {
3381
compile "com.fasterxml.jackson.module:jackson-module-jsonSchema:2.8.5"
3482
compile 'com.github.briandilley.jsonrpc4j:jsonrpc4j:1.5.3'
35-
compileOnly "org.projectlombok:lombok:1.16.20"
3683
testCompile group: 'junit', name: 'junit', version: '4.12'
3784
}

src/main/java/com/github/hiwayama/jsonrpc4j/jsonSchema/JsonRpcSchema.java

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,70 @@
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
44
import com.fasterxml.jackson.module.jsonSchema.JsonSchema;
5-
import lombok.AllArgsConstructor;
6-
import lombok.Getter;
75

86
import java.io.Serializable;
97

108
/**
119
* JSON-RPC API schema Object
10+
*
11+
* request:
12+
* {
13+
* "id": "xxx-xxx-xxx",
14+
* "jsonrpc": "2.0",
15+
* "method": JsonRpcSchema.method,
16+
* "params": JsonRpcSchema.request
17+
* }
18+
*
19+
* response:
20+
* {
21+
* "id": "xxx-xxx-xxx",
22+
* "method": JsonRpcSchema.method,
23+
* "jsonrpc": "2.0",
24+
* "result": JsonRpcSchema.response
25+
* }
1226
*/
13-
@AllArgsConstructor
14-
@Getter
1527
public class JsonRpcSchema implements Serializable {
16-
/**
17-
* JSON-RPC method name
18-
*/
1928
@JsonProperty("method")
2029
private String method;
2130
@JsonProperty("title")
2231
private String title;
23-
/**
24-
* JsonSchema of params object
25-
*/
2632
@JsonProperty("request")
2733
private JsonSchema request;
28-
/**
29-
* JsonSchema of result items
30-
*/
3134
@JsonProperty("response")
3235
private JsonSchema response;
36+
37+
public JsonRpcSchema(String method, String title, JsonSchema request, JsonSchema response) {
38+
this.method = method;
39+
this.title = title;
40+
this.request = request;
41+
this.response = response;
42+
}
43+
44+
/**
45+
* @return JSON-RPC method name
46+
*/
47+
public String getMethod() {
48+
return method;
49+
}
50+
51+
/**
52+
* @return title attribute of JSONSchema
53+
*/
54+
public String getTitle() {
55+
return title;
56+
}
57+
58+
/**
59+
* @return JsonSchema of param object
60+
*/
61+
public JsonSchema getRequest() {
62+
return request;
63+
}
64+
65+
/**
66+
* @return JsonSchema of result items
67+
*/
68+
public JsonSchema getResponse() {
69+
return response;
70+
}
3371
}

src/main/java/com/github/hiwayama/jsonrpc4j/jsonSchema/JsonRpcSchemaGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.fasterxml.jackson.core.JsonProcessingException;
1010
import com.fasterxml.jackson.databind.JsonMappingException;
1111
import com.fasterxml.jackson.databind.ObjectMapper;
12-
import com.fasterxml.jackson.databind.type.TypeFactory;
1312
import com.fasterxml.jackson.module.jsonSchema.JsonSchema;
1413
import com.fasterxml.jackson.module.jsonSchema.JsonSchemaGenerator;
1514
import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper;
@@ -125,8 +124,8 @@ private JsonSchema getCollectionSchema(ParameterizedType type) throws ClassNotFo
125124
* generate API Schemas
126125
* @param serviceClass Service Class of jsonrpc4j
127126
* @return API Schema objects
128-
* @throws JsonProcessingException
129-
* @throws ClassNotFoundException
127+
* @throws JsonProcessingException on error
128+
* @throws ClassNotFoundException on error
130129
*/
131130
public List<JsonRpcSchema> generate(Class<?> serviceClass) throws JsonProcessingException, ClassNotFoundException {
132131
List<JsonRpcSchema> schemas = new ArrayList<>();

0 commit comments

Comments
 (0)