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

Reformat /validate endpoint response #641

Open
csc-jm opened this issue Nov 1, 2022 · 0 comments
Open

Reformat /validate endpoint response #641

csc-jm opened this issue Nov 1, 2022 · 0 comments

Comments

@csc-jm
Copy link
Collaborator

csc-jm commented Nov 1, 2022

Description

Currently validating an xml file via /validate returns a 200 response whether the file is valid or not. However, upon changes done in #630, it was determined that reformatting the response according to JSON Problem specification (https://www.rfc-editor.org/rfc/rfc7807) when the file is in fact invalid. This will require changes in the front-end as well.

DoD (Definition of Done)

The response after an invalid file gets POSTed to the /validate endpoint should instead look e.g. something like this:

{
   "type": "",
   "title": "Bad Request",
   "detail": "Faulty XML file provided."
   "validation-failures": [ {
                         "reason": "Mismatched tag on line 1.",
                         "position": "/ELEMENT_SET"
                       },
                       {
                         "reason": "something else",
                         "position": "/"}
                     ]
   "status": 400,
   "instance": "/validate"
}

Testing

Unit and integration

@csc-jm csc-jm changed the title Reformat Validate endpoint response Reformat /validate endpoint response Nov 1, 2022
@csc-jm csc-jm self-assigned this Nov 9, 2022
@csc-jm csc-jm removed their assignment Dec 14, 2022
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

1 participant