Commit db0324a
Refactor OpenAiImageOptions and enhance test coverage
This commit makes several improvements to the OpenAiImageOptions class:
1. Remove all deprecated methods from OpenAiImageOptions.Builder:
- Removed withN(), withModel(), withQuality(), withResponseFormat(),
withWidth(), withHeight(), withStyle(), and withUser() methods
- These were marked as @deprecated(forRemoval = true, since = "1.0.0-M8")
2. Align OpenAiImageOptions structure with OpenAiChatOptions:
- Added fromOptions() static method for creating copies
- Added copy() instance method
- Updated Builder class to match pattern in OpenAiChatOptions
- Changed Builder field from private final to protected
- Added Builder constructor that takes an existing options object
3. Enhance setSize() method to maintain consistency:
- Updated setSize() to parse the size string and update width/height properties
- Added proper error handling for invalid formats
- Ensures consistent state between size, width, and height properties
4. Comprehensive test coverage improvements:
- Added tests for builder pattern with all fields
- Added tests for copy functionality
- Added tests for all setter methods
- Added tests for default values
- Added tests for equals(), hashCode(), and toString() methods
- Added specific tests for the updated setSize() behavior
- Fixed test expectations to match actual implementation behavior
These changes improve code consistency, maintainability, and test coverage
while removing deprecated methods that were scheduled for removal.
Signed-off-by: jonghoonpark <[email protected]>1 parent 5ad52ff commit db0324a
File tree
4 files changed
+322
-42
lines changed- .claude
- models/spring-ai-openai/src
- main/java/org/springframework/ai/openai
- test/java/org/springframework/ai/openai
- spring-ai-docs/src/main/antora/modules/ROOT/pages
4 files changed
+322
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 47 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
115 | 134 | | |
116 | 135 | | |
117 | 136 | | |
| |||
227 | 246 | | |
228 | 247 | | |
229 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
230 | 263 | | |
231 | 264 | | |
232 | 265 | | |
| |||
258 | 291 | | |
259 | 292 | | |
260 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
261 | 302 | | |
262 | 303 | | |
263 | | - | |
| 304 | + | |
264 | 305 | | |
265 | | - | |
| 306 | + | |
266 | 307 | | |
267 | 308 | | |
268 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
269 | 314 | | |
270 | 315 | | |
271 | 316 | | |
| |||
306 | 351 | | |
307 | 352 | | |
308 | 353 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | 354 | | |
350 | 355 | | |
351 | 356 | | |
| |||
0 commit comments