1- package io.github.smiley4.ktorswaggerui .examples
1+ package io.github.smiley4.ktoropenapi .examples
22
33import io.github.smiley4.ktoropenapi.OpenApi
44import io.github.smiley4.ktoropenapi.config.OpenApiPluginConfig
55import io.github.smiley4.ktoropenapi.config.AuthScheme
66import io.github.smiley4.ktoropenapi.config.AuthType
77import io.github.smiley4.ktoropenapi.get
88import io.github.smiley4.ktoropenapi.openApi
9+ import io.github.smiley4.ktorredoc.redoc
910import io.github.smiley4.ktorswaggerui.config.SwaggerUISort
1011import io.github.smiley4.ktorswaggerui.config.SwaggerUISyntaxHighlight
1112import io.github.smiley4.ktorswaggerui.swaggerUI
@@ -112,7 +113,7 @@ private fun Application.myModule() {
112113 .compileReferencingRoot()
113114 }
114115 overwrite<File >(Schema <Any >().also {
115- it.types = setOf ( " string" )
116+ it.type = " string"
116117 it.format = " binary"
117118 })
118119 }
@@ -137,7 +138,9 @@ private fun Application.myModule() {
137138
138139 routing {
139140
140- // add the routes for swagger-ui and api-spec
141+ route(" api.json" ) {
142+ openApi()
143+ }
141144 route(" swagger" ) {
142145 swaggerUI(" /api.json" ) {
143146 displayOperationId = true
@@ -146,9 +149,48 @@ private fun Application.myModule() {
146149 syntaxHighlight = SwaggerUISyntaxHighlight .MONOKAI
147150 withCredentials = false
148151 }
149- }
150- route(" api.json" ) {
151- openApi()
152+ route(" redoc" ) {
153+ redoc(" /api.json" ) {
154+ disableSearch = false
155+ minCharacterLengthToInitSearch = 1
156+ expandResponses = listOf (" all" )
157+ expandSingleSchemaField = true
158+ hideDownloadButton = false
159+ hideHostname = false
160+ hideLoading = false
161+ hideRequestPayloadSample = true
162+ hideOneOfDescription = false
163+ hideSchemaPattern = false
164+ hideSchemaTitles = true
165+ hideSecuritySection = false
166+ hideSingleRequestSampleTab = true
167+ jsonSampleExpandLevel = " 1"
168+ maxDisplayedEnumValues = 3
169+ menuToggle = true
170+ nativeScrollbars = true
171+ onlyRequiredInSamples = false
172+ pathInMiddlePanel = true
173+ requiredPropsFirst = true
174+ schemaExpansionLevel = " all"
175+ showObjectSchemaExamples = true
176+ showWebhookVerb = true
177+ simpleOneOfTypeLabel = true
178+ sortEnumValuesAlphabetically = true
179+ sortOperationsAlphabetically = true
180+ sortPropsAlphabetically = true
181+ sortTagsAlphabetically = true
182+ theme = """
183+ {
184+ "sidebar": {
185+ "backgroundColor": "lightblue"
186+ },
187+ "rightPanel": {
188+ "backgroundColor": "darkblue"
189+ }
190+ }
191+ """ .trimIndent()
192+ }
193+ }
152194 }
153195
154196 // a documented route
0 commit comments