Skip to content
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

Add Validation Endpoint for Records in InspireHEP #574

Closed
drjova opened this issue Sep 12, 2024 · 2 comments
Closed

Add Validation Endpoint for Records in InspireHEP #574

drjova opened this issue Sep 12, 2024 · 2 comments
Assignees

Comments

@drjova
Copy link
Contributor

drjova commented Sep 12, 2024

We need to add a validation endpoint to the InspireHEP service to validate different types of records, specifically for author workflows. The endpoint should accept a record as a payload and validate it according to the specified type.

TECH NOTES

  • Add a new endpoint in the class AuthorWorkflowViewSet(viewsets.ViewSet) located here.
  • The endpoint should be a POST request to /api/workflows/authors/validate.
  • The endpoint should receive a record as the payload and perform validation using the get_validation_errors method from the inspire_schemas.utils package (ensure inspire_schemas is installed). You can reference the usage of this method in the record class here.
  • Integrate the validation check when creating or updating an author workflow.
  • Update the record editor to use this new endpoint instead of the existing /validate_workflow endpoint for author submissions.

Expected Behavior:

  • If the record validation fails, the endpoint should respond with a 400 status code and include a payload of errors.
  • If the validation passes, the endpoint should respond with a 200 status code.

Acceptance Criteria:

  • Endpoint /api/workflows/authors/validate is implemented and functional.
  • Endpoint correctly validates records based on their type.
  • Returns 400 with validation errors if validation fails.
  • Returns 200 if validation is successful.
  • Validation check is added for create/update operations in author workflows.
  • The record editor is updated to use the new validation endpoint.
  • Unit tests are written for the new endpoint to ensure proper validation behavior.
@PascalEgn
Copy link
Collaborator

PascalEgn commented Sep 17, 2024

We first have to make some changes to inspire-schemas 🫠 pyyaml and urllib3 versions need to be bumped in order to use it in inspire backoffice.
They needed changes are included in: inspirehep/inspire-schemas#465

@PascalEgn
Copy link
Collaborator

Added validation endpoint in inspirehep/backoffice#115

I think it makes sense to wait for inspirehep/inspirehep#3246, to add the validation call in record editor

@drjova drjova closed this as completed Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants