feat: validate layouts before applying slides#475
Conversation
Add early validation of layout names before sending requests to Google Slides API. This prevents mid-process failures due to typos or non-existent layout names.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR adds upfront layout validation to prevent errors when applying slides with nonexistent layouts. The validation occurs before any slide processing, providing early feedback with helpful error messages that list both the missing layouts and the available alternatives.
Key changes:
- Introduced
validateLayoutsmethod that checks all slide layouts against available presentation layouts - Integrated validation into
ApplyPagesto fail fast before slide processing - Added comprehensive unit tests covering valid layouts, invalid layouts, empty layouts with defaults, and multiple invalid layouts
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| deck.go | Implements the validateLayouts method with layout existence checking and descriptive error messages |
| apply.go | Integrates layout validation after presentation refresh but before slide processing |
| deck_test.go | Adds TestValidateLayouts with 4 test cases covering various validation scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bc63a5d to
2037935
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2037935 to
f816ebd
Compare
Code Metrics Report
Details | | main (eea4594) | #475 (a5dff82) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 33.2% | 33.8% | +0.5% |
| Files | 31 | 31 | 0 |
| Lines | 3382 | 3405 | +23 |
+ | Covered | 1126 | 1151 | +25 |
+ | Code to Test Ratio | 1:0.9 | 1:0.9 | +0.0 |
| Code | 6985 | 7020 | +35 |
+ | Test | 6453 | 6581 | +128 |
+ | Test Execution Time | 10s | 9s | -1s |Code coverage of files in pull request scope (1.6% → 5.3%)
Reported by octocov |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix: #199
This pull request adds validation to ensure that all slide layouts specified in a deck exist in the presentation before applying changes. It introduces a new
validateLayoutsmethod and comprehensive unit tests to prevent errors caused by referencing nonexistent layouts.Validation improvements:
validateLayoutsto theDecktype, which checks that all layouts used in the provided slides exist in the presentation. If any are missing, it returns an error listing the missing and available layouts.validateLayoutscheck into theApplyPagesmethod, so layout validation occurs before processing slides.