File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/util Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,22 @@ internal fun typeNameFromKind(kind: SerialKind): String {
138
138
}
139
139
}
140
140
141
+ /* *
142
+ * Extracts the name expected for a class from its serial name.
143
+ *
144
+ * Our serialization classes are nested within the public-facing classes, and that's the name we
145
+ * want in the json output. There are two class names
146
+ *
147
+ * - `com.google.firebase.vertexai.type.Content.Internal` for regular scenarios
148
+ * - `com.google.firebase.vertexai.type.Content.Internal.SomeClass` for nested classes in the
149
+ * serializer.
150
+ *
151
+ * For the later time we need the second to last component, for the former we need the last
152
+ * component.
153
+ *
154
+ * Additionally, given that types can be nullable, we need to strip the `?` from the end of the
155
+ * name.
156
+ */
141
157
internal fun simpleNameFromSerialName (serialName : String ): String =
142
158
serialName
143
159
.split(" ." )
You can’t perform that action at this time.
0 commit comments