feat(data-access): add type-specific data schemas for suggestions [SITES-39183]#1289
Merged
Kanishkavijay39 merged 6 commits intomainfrom Feb 2, 2026
Merged
feat(data-access): add type-specific data schemas for suggestions [SITES-39183]#1289Kanishkavijay39 merged 6 commits intomainfrom
Kanishkavijay39 merged 6 commits intomainfrom
Conversation
25bbd29 to
94e646f
Compare
|
This PR will trigger a minor release when merged. |
…URL extraction - Remove extractUrl() method and urlExtraction config (unused in production) - Reduce FALLBACK_PROJECTION from 25 fields to 14 URL-only fields - Remove urlExtraction property from all opportunity type schemas - Update tests to reflect simplified implementation This change reduces complexity by removing speculative features that were only used in tests, following YAGNI principle and Single Responsibility Principle.
- Resolved conflict in suggestion.model.js - Kept REJECTED status from main - Kept all new schema methods and properties from feature branch - All tests passing
iuliag
approved these changes
Jan 29, 2026
packages/spacecat-shared-data-access/src/models/suggestion/suggestion.data-schemas.js
Outdated
Show resolved
Hide resolved
packages/spacecat-shared-data-access/src/models/suggestion/suggestion.data-schemas.js
Outdated
Show resolved
Hide resolved
- Made minimal projection fields required across all opportunity types - Validated schemas against actual suggestion data for 20+ opportunity types - Added missing fields discovered through data validation (aiRationale, urlsSuggested, priority, etc.) - Fixed projection mismatches (removed fields not in requirements, added missing required fields) - Added comprehensive schemas for: CANONICAL, HEADINGS, HREFLANG, INVALID_OR_MISSING_METADATA, SITEMAP, SITEMAP_PRODUCT_COVERAGE, BROKEN_BACKLINKS, BROKEN_INTERNAL_LINKS, REDIRECT_CHAINS, PRERENDER, HIGH_ORGANIC_LOW_CTR, LLM_BLOCKED - Updated JSDoc example to clarify required vs optional field pattern - Organized schemas into clear sections: validated, needs validation, and to be added - Fixed linter errors (line length violations) Follows design principle: fields in minimal projection must be required, others optional.
solaris007
pushed a commit
that referenced
this pull request
Feb 2, 2026
# [@adobe/spacecat-shared-data-access-v2.100.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.99.0...@adobe/spacecat-shared-data-access-v2.100.0) (2026-02-02) ### Features * **data-access:** add type-specific data schemas for suggestions [SITES-39183] ([#1289](#1289)) ([9824b22](9824b22))
Member
|
🎉 This PR is included in version @adobe/spacecat-shared-data-access-v2.100.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Kanishkavijay39
added a commit
to adobe/spacecat-api-service
that referenced
this pull request
Feb 5, 2026
## Summary Adds field projection via a `view` query parameter and optional status filtering to the Suggestions API endpoints. This allows clients to request lighter payloads optimized for specific UI needs (e.g., selection lists, table displays). Implements API projection for suggestions with a schema-driven architecture. This PR integrates with spacecat-shared PR-1289 which provides type-specific data schemas, validation, and projection logic. adobe/spacecat-shared#1289 ## Changes ### `view` parameter Pre-defined projections for all GET suggestion endpoints: | View | Returns | Use Case | |------|---------|----------| | `minimal` | `id`, `status`, URL-related `data` fields | Lightest payload for selection lists | | `summary` | Minimal + `opportunityId`, `type`, `rank`, `url`, timestamps | Table displays without heavy data | | `full` | All fields including `data` and `kpiDeltas` | Default, backward compatible | ### `status` parameter Filter suggestions by status (non-paginated endpoint only): - Single status: `?status=NEW` - Multiple statuses: `?status=NEW,APPROVED,IN_PROGRESS` - Valid values: `NEW`, `APPROVED`, `SKIPPED`, `FIXED`, `ERROR`, `IN_PROGRESS`, `OUTDATED`, `PENDING_VALIDATION` - Returns `400 Bad Request` for invalid status values > **Note:** Status filtering excluded from paginated endpoints to avoid pagination inconsistencies. Use `/by-status/{status}/paged` for paginated status-filtered results. ## Example Usage ### Minimal view for selection list GET /sites/{siteId}/opportunities/{opptyId}/suggestions?view=minimal ### Summary view with status filter GET /sites/{siteId}/opportunities/{opptyId}/suggestions?view=summary&status=NEW,FIXED ### Full view (default) GET /sites/{siteId}/opportunities/{opptyId}/suggestions --------- Co-authored-by: Kanishka <kanishka@adobe.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add type-specific data schemas for suggestion opportunity types to enable validation, flexible projections, and maintainability.
Motivation
Previously, suggestion data structures had no validation or type-specific configurations, making it difficult to:
Changes
New Features
Data Schemas (
suggestion.data-schemas.js)structured-data,color-contrast,a11y-assistive,cwv,alt-text,security-permissions,security-vulnerabilities,form-accessibilityProjection Utilities (
suggestion.projection-utils.js)filterIssuesOccurrences,filterCwvMetrics, etc.)Model Enhancements (
suggestion.model.js)getProjection(opportunityType, viewName)- Returns projection configvalidateData(data, opportunityType)- Validates against Joi schemaTesting
adobe/spacecat-api-service#1693
To test with feature branch tarball:
{
"dependencies": {
"@adobe/spacecat-shared-data-access": "https://gist.github.com/Kanishkavijay39/3e10f6de31238e7ed188269f3a1cbd15/raw/adobe-spacecat-shared-data-access-2.96.0.tgz"
}
}
Thanks for contributing!