Coverage Summary for Class: DispatchNamesResolver (com.ghost.serialization.compiler)

Class Class, % Method, % Branch, % Line, % Instruction, %
DispatchNamesResolver 100% (1/1) 100% (1/1) 70% (7/10) 100% (9/9) 92.1% (35/38)


 package com.ghost.serialization.compiler
 
 /**
  * Shared top-level JSON field name ordering for perfect-hash OPTIONS and parse-loop `when` branches.
  */
 internal object DispatchNamesResolver {
 
     fun topLevelNames(properties: List<GhostPropertyModel>): List<String> {
         return properties.flatMap { prop ->
             if (prop.wrappedSourceKeys != null) {
                 prop.wrappedSourceKeys
             } else {
                 listOf(
                     prop.flattenPath?.firstOrNull()
                         ?: prop.wrapPath?.firstOrNull()
                         ?: prop.jsonName,
                 )
             }
         }.distinct()
     }
 }