fun testAgentSkillSerialization()

in a2a/a2a-core/src/commonTest/kotlin/ai/koog/a2a/model/AgentCardSerializationTest.kt [476:531]


    fun testAgentSkillSerialization() {
        val skill = AgentSkill(
            id = "test-skill",
            name = "Test Skill",
            description = "A comprehensive test skill",
            tags = listOf("test", "demo"),
            examples = listOf("How to test?", "Show me a demo"),
            inputModes = listOf("text/plain", "application/json"),
            outputModes = listOf("text/plain"),
            security = listOf(
                mapOf("oauth" to listOf("read", "write")),
                mapOf("api-key" to emptyList())
            )
        )

        //language=JSON
        val expectedJson = """
            {
                "id": "test-skill",
                "name": "Test Skill",
                "description": "A comprehensive test skill",
                "tags": [
                    "test",
                    "demo"
                ],
                "examples": [
                    "How to test?",
                    "Show me a demo"
                ],
                "inputModes": [
                    "text/plain",
                    "application/json"
                ],
                "outputModes": [
                    "text/plain"
                ],
                "security": [
                    {
                        "oauth": [
                            "read",
                            "write"
                        ]
                    },
                    {
                        "api-key": []
                    }
                ]
            }
        """.trimIndent()

        val json = TestJson.encodeToString(skill)
        assertEquals(expectedJson, json)

        val deserialized = TestJson.decodeFromString<AgentSkill>(json)
        assertEquals(skill, deserialized)
    }