Commit 1bee8d4
authored
refactor(mcp): remove redundant type field from Content implementations (#27)
- The type field and associated methods were redundant in Content implementations (TextContent, ImageContent, EmbeddedResource)
as the type information is already handled by Jackson's polymorphic type handling via @JsonSubTypes annotation.
- Add default implementation that returns the appropriate type string based on the implementing class (text, image, or resource)
- Added comprehensive unit tests for McpSchema to validate serialization/deserialization behavior of all schema components.
- Add deserialization tests for all content types
- Add json-unit-assertj for flexible JSON testing - ignores array order and extra array items, reducing test brittleness while
maintaining functional validation.
Resolves #26
Resolve spring-projects/spring-ai#2350
Signed-off-by: Christian Tzolov <[email protected]>1 parent b2c62d5 commit 1bee8d4
File tree
4 files changed
+619
-33
lines changed- mcp
- src
- main/java/io/modelcontextprotocol/spec
- test/java/io/modelcontextprotocol/spec
4 files changed
+619
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
161 | 169 | | |
162 | 170 | | |
163 | 171 | | |
164 | 172 | | |
165 | 173 | | |
166 | | - | |
| 174 | + | |
167 | 175 | | |
168 | 176 | | |
169 | 177 | | |
| |||
183 | 191 | | |
184 | 192 | | |
185 | 193 | | |
186 | | - | |
| 194 | + | |
Lines changed: 13 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
964 | 964 | | |
965 | 965 | | |
966 | 966 | | |
967 | | - | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
968 | 979 | | |
969 | 980 | | |
970 | 981 | | |
971 | 982 | | |
972 | 983 | | |
973 | 984 | | |
974 | 985 | | |
975 | | - | |
976 | 986 | | |
977 | 987 | | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | 988 | | |
987 | | - | |
| 989 | + | |
988 | 990 | | |
989 | 991 | | |
990 | 992 | | |
991 | 993 | | |
992 | 994 | | |
993 | 995 | | |
994 | 996 | | |
995 | | - | |
996 | 997 | | |
997 | 998 | | |
998 | | - | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | 999 | | |
1007 | 1000 | | |
1008 | 1001 | | |
1009 | 1002 | | |
1010 | 1003 | | |
1011 | 1004 | | |
1012 | | - | |
1013 | 1005 | | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | 1006 | | |
1023 | 1007 | | |
1024 | 1008 | | |
| |||
0 commit comments