Skip to content

Commit

Permalink
Kotlin code conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Jan 8, 2025
1 parent 441746d commit 2c28a5d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .idea/copyright/apache2_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 9 additions & 29 deletions src/commonMain/kotlin/generator/JsonSchemaGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,15 @@

package com.xemantic.ai.tool.schema.generator

import com.xemantic.ai.tool.schema.ArraySchema
import com.xemantic.ai.tool.schema.BooleanSchema
import com.xemantic.ai.tool.schema.IntegerSchema
import com.xemantic.ai.tool.schema.JsonSchema
import com.xemantic.ai.tool.schema.NumberSchema
import com.xemantic.ai.tool.schema.ObjectSchema
import com.xemantic.ai.tool.schema.StringFormat
import com.xemantic.ai.tool.schema.StringSchema
import com.xemantic.ai.tool.schema.meta.ContentMediaType
import com.xemantic.ai.tool.schema.meta.Description
import com.xemantic.ai.tool.schema.meta.Encoding
import com.xemantic.ai.tool.schema.meta.Format
import com.xemantic.ai.tool.schema.meta.FormatString
import com.xemantic.ai.tool.schema.meta.ItemDescription
import com.xemantic.ai.tool.schema.meta.ItemTitle
import com.xemantic.ai.tool.schema.meta.Max
import com.xemantic.ai.tool.schema.meta.MaxInt
import com.xemantic.ai.tool.schema.meta.MaxItems
import com.xemantic.ai.tool.schema.meta.MaxLength
import com.xemantic.ai.tool.schema.meta.Min
import com.xemantic.ai.tool.schema.meta.MinInt
import com.xemantic.ai.tool.schema.meta.MinItems
import com.xemantic.ai.tool.schema.meta.MinLength
import com.xemantic.ai.tool.schema.meta.Pattern
import com.xemantic.ai.tool.schema.meta.Title
import com.xemantic.ai.tool.schema.meta.UniqueItems
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlin.collections.set
import com.xemantic.ai.tool.schema.*
import com.xemantic.ai.tool.schema.meta.*
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.SerialKind
import kotlinx.serialization.descriptors.StructureKind
import kotlinx.serialization.serializer

/**
* Generates a JSON schema for the specified type [T].
Expand Down
7 changes: 1 addition & 6 deletions src/commonMain/kotlin/serialization/JsonSchemaSerializer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.buildSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.JsonDecoder
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.*

public object JsonSchemaSerializer : KSerializer<JsonSchema> {

Expand Down
4 changes: 2 additions & 2 deletions src/commonTest/kotlin/JsonSchemaTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.xemantic.ai.tool.schema

import io.kotest.assertions.json.shouldEqualJson
import com.xemantic.kotlin.test.should
import com.xemantic.kotlin.test.have
import com.xemantic.kotlin.test.should
import io.kotest.assertions.json.shouldEqualJson
import kotlin.test.Test
import kotlin.test.assertFailsWith

Expand Down
20 changes: 1 addition & 19 deletions src/commonTest/kotlin/generator/JsonSchemaGeneratorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,7 @@ package com.xemantic.ai.tool.schema.generator

import com.xemantic.ai.tool.schema.ContentEncoding
import com.xemantic.ai.tool.schema.StringFormat
import com.xemantic.ai.tool.schema.meta.ContentMediaType
import com.xemantic.ai.tool.schema.meta.Description
import com.xemantic.ai.tool.schema.meta.Encoding
import com.xemantic.ai.tool.schema.meta.Format
import com.xemantic.ai.tool.schema.meta.ItemDescription
import com.xemantic.ai.tool.schema.meta.ItemTitle
import com.xemantic.ai.tool.schema.meta.Max
import com.xemantic.ai.tool.schema.meta.MaxInt
import com.xemantic.ai.tool.schema.meta.MaxItems
import com.xemantic.ai.tool.schema.meta.MaxLength
import com.xemantic.ai.tool.schema.meta.Min
import com.xemantic.ai.tool.schema.meta.MinInt
import com.xemantic.ai.tool.schema.meta.MinItems
import com.xemantic.ai.tool.schema.meta.MinLength
import com.xemantic.ai.tool.schema.meta.MultipleOf
import com.xemantic.ai.tool.schema.meta.MultipleOfInt
import com.xemantic.ai.tool.schema.meta.Pattern
import com.xemantic.ai.tool.schema.meta.Title
import com.xemantic.ai.tool.schema.meta.UniqueItems
import com.xemantic.ai.tool.schema.meta.*
import com.xemantic.ai.tool.schema.test.BigDecimal
import com.xemantic.ai.tool.schema.test.Money
import com.xemantic.ai.tool.schema.test.testJson
Expand Down
6 changes: 1 addition & 5 deletions src/commonTest/kotlin/test/Money.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ package com.xemantic.ai.tool.schema.test

import com.xemantic.ai.tool.schema.meta.Description
import com.xemantic.ai.tool.schema.meta.Pattern
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.InternalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.Serializer
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.buildSerialDescriptor
import kotlinx.serialization.encoding.Decoder
Expand Down

0 comments on commit 2c28a5d

Please sign in to comment.