Skip to content

Commit e59fbc4

Browse files
committed
Expose MappingReader and MappingWriter
Jenkins Blue Ocean made interesting design choices relating github-api interactions. They mostly reused the existing API and OM, but in a few places they chose to implement their own object mapping independent of this project. This is fine as long as nothing in this project ever changes, including internals such as ObjectMapper configuration or behavior. Recent release have made changes to those internals which break assumptions made in Blue Ocean. This change exposes this project's MappingReader and MappingWriter to allow for a fix to Blue Ocean requiring only minimal changes. This doesn't prevent future changes from breaking Blue Ocean but at least makes them much less likely.
1 parent 76c5192 commit e59fbc4

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/main/java/org/kohsuke/github/GitHub.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
*/
2424
package org.kohsuke.github;
2525

26+
import com.fasterxml.jackson.databind.ObjectReader;
27+
import com.fasterxml.jackson.databind.ObjectWriter;
2628
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
2729

2830
import java.io.*;
@@ -1190,6 +1192,33 @@ public Reader renderMarkdown(String text) throws IOException {
11901192
"UTF-8");
11911193
}
11921194

1195+
/**
1196+
* Gets an {@link ObjectWriter}. Do not use this method.
1197+
*
1198+
* @return an {@link ObjectWriter} instance that can be further configured.
1199+
* @deprecated Provided for backward compatibility with projects that did their own jackson mapping of this
1200+
* project's data objects, such as Jenkins Blue Ocean.
1201+
*/
1202+
@Deprecated
1203+
@Nonnull
1204+
public static ObjectWriter getMappingObjectWriter() {
1205+
return GitHubClient.getMappingObjectWriter();
1206+
}
1207+
1208+
/**
1209+
* Do not use this method. Objects mapped using the reader returned from this method will have minimal data mapped
1210+
* into them and not be fully functional. Use at your own risk.
1211+
*
1212+
* @return an {@link ObjectReader} instance that can be further configured.
1213+
* @deprecated Provided for backward compatibility with projects that did their own jackson mapping of this
1214+
* project's data objects, such as Jenkins Blue Ocean.
1215+
*/
1216+
@Deprecated
1217+
@Nonnull
1218+
public static ObjectReader getMappingObjectReader() {
1219+
return GitHubClient.getMappingObjectReader(GitHub.offline());
1220+
}
1221+
11931222
@Nonnull
11941223
GitHubClient getClient() {
11951224
return client;

0 commit comments

Comments
 (0)