@@ -138,31 +138,40 @@ public class SchemaSymbolProcessor(
138138 val builder = CodeBlock .builder()
139139 when (className.canonicalName) {
140140 " kotlin.Int" -> {
141- builder.addStatement(" Schema.integer(" )
141+ builder.addStatement(" Schema.integer(" ).indent()
142142 }
143143 " kotlin.Long" -> {
144- builder.addStatement(" Schema.long(" )
144+ builder.addStatement(" Schema.long(" ).indent()
145145 }
146146 " kotlin.Boolean" -> {
147- builder.addStatement(" Schema.boolean(" )
147+ builder.addStatement(" Schema.boolean(" ).indent()
148148 }
149149 " kotlin.Float" -> {
150- builder.addStatement(" Schema.float(" )
150+ builder.addStatement(" Schema.float(" ).indent()
151151 }
152152 " kotlin.Double" -> {
153- builder.addStatement(" Schema.double(" )
153+ builder.addStatement(" Schema.double(" ).indent()
154154 }
155155 " kotlin.String" -> {
156- builder.addStatement(" Schema.string(" )
156+ builder.addStatement(" Schema.string(" ).indent()
157157 }
158158 else -> {
159159 if (className.canonicalName == " kotlin.collections.List" ) {
160160 val listTypeParam = type.arguments.first().type!! .resolve()
161161 val listParamCodeBlock =
162162 generateCodeBlockForSchema(type = listTypeParam, parentType = type)
163- builder.addStatement(" Schema.array(items = " ).add(listParamCodeBlock).addStatement(" ," )
163+ builder
164+ .addStatement(" Schema.array(" )
165+ .indent()
166+ .addStatement(" items = " )
167+ .add(listParamCodeBlock)
168+ .addStatement(" ," )
164169 } else {
165- builder.addStatement(" Schema.obj(properties = " )
170+ builder
171+ .addStatement(" Schema.obj(" )
172+ .indent()
173+ .addStatement(" properties = mapOf(" )
174+ .indent()
166175 val properties =
167176 (type.declaration as KSClassDeclaration ).getAllProperties().associate { property ->
168177 val propertyName = property.simpleName.asString()
@@ -178,11 +187,15 @@ public class SchemaSymbolProcessor(
178187 },
179188 )
180189 }
181- builder.addStatement(" mapOf(" )
182190 properties.entries.forEach {
183- builder.addStatement(" %S to " , it.key).add(it.value).addStatement(" , " )
191+ builder
192+ .addStatement(" %S to " , it.key)
193+ .indent()
194+ .add(it.value)
195+ .unindent()
196+ .addStatement(" , " )
184197 }
185- builder.addStatement(" )," )
198+ builder.unindent(). addStatement(" )," )
186199 }
187200 }
188201 }
@@ -225,7 +238,7 @@ public class SchemaSymbolProcessor(
225238 if (format != null ) {
226239 builder.addStatement(" format = %S," , format)
227240 }
228- builder.addStatement(" nullable = %L)" , className.isNullable)
241+ builder.addStatement(" nullable = %L)" , className.isNullable).unindent()
229242 return builder.build()
230243 }
231244
0 commit comments