File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
examples/javalin-gradle-kotlin/src/main/java/io/javalin/openapi/plugin/test
javalin-plugins/javalin-openapi-plugin/src/main/kotlin/io/javalin/openapi/plugin Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ public static void main(String[] args) {
92
92
.withScope ("write_pets" )
93
93
.withScope ("read_pets" )
94
94
)
95
+ .withGlobalSecurity ("BearerAuth" )
95
96
)
96
97
.withDefinitionProcessor (content -> { // you can add whatever you want to this document using your favourite json api
97
98
content .set ("test" , new TextNode ("Value" ));
Original file line number Diff line number Diff line change @@ -47,8 +47,12 @@ open class OpenApiPlugin(userConfig: Consumer<OpenApiPluginConfiguration>) : Plu
47
47
val docsNode = jsonMapper.readTree(content) as ObjectNode
48
48
49
49
// process OpenAPI "info"
50
- val currentInfo = jsonMapper.readerForUpdating(docsNode.get(" info" ))
51
- docsNode.replace(" info" , currentInfo.readValue(jsonMapper.convertValue(info, JsonNode ::class .java)))
50
+ val updatedInfo =
51
+ docsNode.get(" info" )
52
+ ?.let { jsonMapper.readerForUpdating(it) }
53
+ ?.readValue<JsonNode >(jsonMapper.convertValue(info, JsonNode ::class .java))
54
+ ? : jsonMapper.convertValue(info, JsonNode ::class .java)
55
+ docsNode.replace(" info" , updatedInfo)
52
56
53
57
// process OpenAPI "servers"
54
58
docsNode.replace(" servers" , jsonMapper.convertValue(servers, JsonNode ::class .java))
You can’t perform that action at this time.
0 commit comments