-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Content Import Job Management] Implement the Content Import Validate Job REST endpoint #30771
Comments
### Proposed Changes * Added a new class `ContentImportParamsSchema` to define the schema for content import parameters, ensuring better API documentation and clarity. * Updated the `ContentImportResource` to include validation for import parameters and support for a new `_validate` endpoint. * Refactored `ContentImportResource` to utilize `ContentImportParamsSchema` for improved parameter handling. * Enhanced Swagger documentation to include detailed descriptions and examples for the import parameters. * Renamed `_import` package to `dotimport` for better naming consistency. ### Checklist - [x] Tests - [x] Translations - [x] Security Implications Contemplated (Added input validation and restricted endpoint usage based on user permissions.) ### Additional Info The `_validate` endpoint allows for previewing the content import process. This enhancement helps users validate their CSV and settings before committing to an import job. The changes also address the issue where `ContentImportParamsSchema` was missing, leading to inaccurate Swagger documentation. ### Swagger Screenshot <img width="946" alt="image" src="https://github.com/user-attachments/assets/93934cba-ae73-4540-a8c1-fe5b3aa6d74c">
Passed Internal QA
Videoissue-30771-content-import-job-management-implement-the-content-import-validate-job-rest-endpoint-iqa.mov |
Testing findings and improvements neededCurrent issues:
Improvements needed:
Suggestions: {
"status": 400,
"statusText": "",
"error": [
{
"errorCode": null,
"fieldName": "jsonForm",
"message": "Form data is required to specify content type, language and workflow. Please include a valid JSON form object."
}
]
}
{
"status": 400,
"statusText": "",
"error": {
"message": "Content Type 'NonExistentType' not found. Available types are: Blog, News, FakeContent."
}
}
{
"status": 400,
"statusText": "",
"error": {
"message": "Invalid workflow action ID 'invalid-uuid'. Workflow action must be a valid UUID from an existing workflow."
}
}
{
"status": 400,
"statusText": "",
"error": {
"message": "File must be a valid CSV with required headers: contentHost, title. Please check file format and try again."
}
}
{
"status": 400,
"statusText": "",
"error": {
"message": "Language code 'invalid' not found. Available languages are: 1 (English), 2 (Spanish)."
}
} |
Improvements needed
Current response: {
"result": {
"errorDetail": null,
"metadata": {
"counters": [],
"errors": [],
"identifiers": [],
"lastInode": [],
"messages": [
"1 headers found on the file matches all the Content Type fields.",
"4 lines of data were read.",
"Attempting to create 3 contentlets - check below for errors affecting input"
],
"results": [
"3 New \"Fake Content\" were created.",
"0 \"Fake Content\" content updated corresponding to 0 repeated content based on the key provided"
],
"updatedInodes": [],
"warnings": [
"Header \"contentHost\" doesn't match any Content Type field; this column of data will be ignored.",
"No key fields were chosen, this could result in duplicated content.",
"Not all the Content Type fields match the file headers. Some fields may be empty."
],
"wfActionId": []
}
}
} Can have a more structured approach like this: {
"results": {
"file": {
"totalRows": 4,
"parsedRows": 3,
"headers": {
"valid": ["title"],
"invalid": ["contentHost"],
"missing": ["image", "blogs"]
}
},
"data": {
"processed": {
"valid": 3,
"invalid": 0
},
"summary": {
"created": 3,
"updated": 0,
"contentType": "Fake Content"
}
},
"warnings": [
{
"code": "INVALID_HEADER",
"field": "contentHost",
"message": "Header doesn't match any Content Type field; column will be ignored"
},
{
"code": "MISSING_KEY_FIELD",
"message": "No key fields specified, may result in duplicate content"
},
{
"code": "INCOMPLETE_HEADERS",
"message": "Not all Content Type fields match file headers. Some fields may be empty"
}
],
"errors": [
{
"code": "INVALID_FILE_TYPE",
"message": "File type is not supported"
},
{
"code": "INVALID_IMAGE_PATH",
"row": 2,
"field": "image",
"value": "/invalid/path.jpg",
"message": "Image path not found in Site Browser"
},
{
"code": "INVALID_RELATIONSHIP",
"row": 3,
"field": "blogs",
"value": "invalid-blog-id",
"message": "Blog with ID 'invalid-blog-id' not found"
},
{
"code": "REQUIRED_FIELD_MISSING",
"row": 4,
"field": "title",
"message": "Required field 'title' is missing"
}
]
}
} The improved version is better because it:
|
@fmontes please create separate issues for 1 and 2. These errors you got belong to the jobs endpoint ( |
We have created these cards to address the issues and suggested improvements: |
Parent Issue
#30550
Task
Implement the POST /content/_import/_validate endpoint to allow the creation and enqueuing of new content import jobs in preview mode. This endpoint will initiate the content import dry run process and return a unique job identifier.
POST /content/_import/_validate
Parameters:
contentId
,title
).Description:
This endpoint creates a new content import job in preview mode, enqueues it into the job queue, and returns a unique job identifier. The content import will proceed based on the provided parameters and failure handling options.###
Proposed Objective
Core Features
Proposed Priority
Priority 2 - Important
Acceptance Criteria
External Links... Slack Conversations, Support Tickets, Figma Designs, etc.
No response
Assumptions & Initiation Needs
No response
Quality Assurance Notes & Workarounds
No response
Sub-Tasks & Estimates
No response
The text was updated successfully, but these errors were encountered: