package test

import (
	"fmt"
	"github.com/deeptest-com/deeptest/internal/pkg/helper/openapi/thirdPart"
	_commUtils "github.com/deeptest-com/deeptest/pkg/lib/comm"
	"testing"
)

func TestThirdPart(t *testing.T) {
	json := "{\n                    \"className\": {\n                        \"filedName\": \"className\",\n                        \"kid\": \"31860aa7-6b0a-4429-a669-485c89d24079\",\n                        \"description\": \"\",\n                        \"sort\": 0,\n                        \"type\": \"string\",\n                        \"example\": \"默认值\"\n                    },\n                    \"thisObj\": {\n                        \"filedName\": \"thisObj\",\n                        \"kid\": \"78d8fa7f-704d-451c-9de0-903b87a9cee5\",\n                        \"description\": \"\",\n                        \"sort\": 1,\n                        \"type\": \"object\",\n                        \"properties\": {\n                            \"field12\": {\n                                \"filedName\": \"field12\",\n                                \"kid\": \"5e28efdd-05b8-4d99-b490-64284d77ff31\",\n                                \"description\": \"\",\n                                \"sort\": 0,\n                                \"type\": \"array\",\n                                \"properties\": {\n                                    \"items\": {\n                                        \"parentArr\": true,\n                                        \"filedName\": \"items\",\n                                        \"kid\": \"81348b6c-cea8-466b-be35-0c392e530f6e\",\n                                        \"description\": \"\",\n                                        \"sort\": 0,\n                                        \"type\": \"string\",\n                                        \"example\": \"默认值\"\n                                    }\n                                },\n                                \"example\": \"默认值\"\n                            },\n                            \"field1\": {\n                                \"filedName\": \"field1\",\n                                \"kid\": \"652eaafa-4bf6-43cc-bc88-8281cde6057e\",\n                                \"description\": \"\",\n                                \"sort\": 1,\n                                \"type\": \"number\",\n                                \"example\": \"默认值\"\n                            },\n                            \"field7\": {\n                                \"filedName\": \"field7\",\n                                \"kid\": \"eb3b125d-12df-438c-853e-dfbd0b992bf6\",\n                                \"description\": \"\",\n                                \"sort\": 7,\n                                \"type\": \"char\",\n                                \"example\": \"默认值\"\n                            },\n                            \"field6\": {\n                                \"filedName\": \"field6\",\n                                \"kid\": \"5bc466d6-1f82-4cf0-a61b-97b3f0f7cd98\",\n                                \"description\": \"\",\n                                \"sort\": 6,\n                                \"type\": \"datetime\",\n                                \"example\": \"默认值\"\n                            },\n                            \"field3\": {\n                                \"filedName\": \"field3\",\n                                \"kid\": \"f0d5e961-ec2c-4f8a-a923-f07935ec3efb\",\n                                \"description\": \"\",\n                                \"sort\": 3,\n                                \"type\": \"boolean\",\n                                \"example\": \"默认值\"\n                            },\n                            \"field2\": {\n                                \"filedName\": \"field2\",\n                                \"kid\": \"b46e6e3f-2f95-4a61-ba6e-14b1f02af547\",\n                                \"description\": \"\",\n                                \"sort\": 2,\n                                \"type\": \"integer\",\n                                \"example\": \"默认值\"\n                            },\n                            \"field5\": {\n                                \"filedName\": \"field5\",\n                                \"kid\": \"f8f7c238-165f-434e-9f2e-144e323fa307\",\n                                \"description\": \"\",\n                                \"sort\": 5,\n                                \"type\": \"date\",\n                                \"example\": \"默认值\"\n                            },\n                            \"field4\": {\n                                \"filedName\": \"field4\",\n                                \"kid\": \"f39fe13b-4a64-4c36-8922-b5f9d7387dee\",\n                                \"description\": \"\",\n                                \"sort\": 4,\n                                \"type\": \"double\",\n                                \"example\": \"默认值\"\n                            }\n                        },\n                        \"example\": \"默认值\"\n                    }\n                }"
	var schemas thirdPart.Schemas
	_commUtils.JsonDecode(json, &schemas)
	res := thirdPart.NewThirdPart2conv().Convert(schemas)
	x := _commUtils.JsonEncode(res)
	fmt.Println(x)
}
