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

Provide metadata validation to the proposal list and on the GA creation #876

Closed
MSzalowski opened this issue Apr 26, 2024 · 3 comments · Fixed by #889
Closed

Provide metadata validation to the proposal list and on the GA creation #876

MSzalowski opened this issue Apr 26, 2024 · 3 comments · Fixed by #889
Labels

Comments

@MSzalowski
Copy link
Contributor

  1. Provide new POST endpoint that would accept metadat url and hash and return the status of the validation.
    Example payload:
{
   "url": "http://example.metadata.url",
   "hash": "some-example-blake2b-256-hash",
}

Example response:

  • Incorrect format - when fields of JSONLD file provided under url don't match the CIP-108 standard.
{
   "status": "INCORRECT_FORMAT",
}
  • Incorrect jsonld - when file is not canonizable by jsonld standard
{
   "status": "INCORRECT_JSONLD",
}
  • Incorrect hash - when hash of the file provided under url doesn't match provided hash
{
   "status": "INCORRECT_HASH",
}
  • Url not found - when provided url is not reachable.
{
   "status": "URL_NOT_FOUND",
}

If validation passes for all the cases response can be any eg.: { "valid": true }

  1. Extend existing endpoints of such validation.

Provide to:
GET /proposal/list
GET /proposal/get/{proposalId}
GET /drep/getVotes/{drepId}

  • Validation described on the point 1
  • Additional field that informs about the validation status to each proposal/vote
@MSzalowski MSzalowski moved this to To do in Govtool all Apr 26, 2024
@jankun4 jankun4 moved this from To do to In progress in Govtool all Apr 29, 2024
jankun4 added a commit that referenced this issue Apr 29, 2024
jankun4 added a commit that referenced this issue Apr 29, 2024
a/validate endpoint

Signed-off-by: jankun4 <michaljankun@gmail.com>
@jankun4 jankun4 linked a pull request Apr 29, 2024 that will close this issue
5 tasks
jankun4 added a commit that referenced this issue Apr 29, 2024
Signed-off-by: jankun4 <michaljankun@gmail.com>
jankun4 added a commit that referenced this issue Apr 29, 2024
Signed-off-by: jankun4 <michaljankun@gmail.com>
@MSzalowski MSzalowski added the 🖥 Frontend Frontend related label May 8, 2024
jankun4 added a commit that referenced this issue May 8, 2024
jankun4 added a commit that referenced this issue May 8, 2024
@MSzalowski MSzalowski moved this from In progress to In review in Govtool all May 9, 2024
Sworzen1 added a commit that referenced this issue May 9, 2024
…tion-to-the-proposal-list-and-on-the-ga-creation

[#876] add metadata/validate endpoint
@github-project-automation github-project-automation bot moved this from In review to Done in Govtool all May 9, 2024
@Sworzen1 Sworzen1 moved this from Done to In QA in Govtool all May 9, 2024
@pmbinapps
Copy link

pmbinapps commented May 14, 2024

Still blocked to check on dev-sancho and test-sancho env:

Blocked by:
[

Image
](#1011)

#1015

@pmbinapps
Copy link

pmbinapps commented May 14, 2024

OK Adding proposal
NOT OK - showing proposals - tracked here

@pmbinapps
Copy link

pmbinapps commented Jun 3, 2024

OK,  TBC - response ok, status ok, for case: URL ok, hash ok, expected: 200, status: None - NOT STATUS FOR CORRECT STATE 
Inputs:
 {
    "url": "https://raw.githubusercontent.com/mpawel79/testrepo/master/InfoJune03.jsonld",
    "hash": "eebfff0e2213ff0c5331e6d9d99d47a5a825dce7053671b6ed4daae4b4e0df5e"
}
Response code: 200
{
    "status": null,
    "valid": false,
    "raw": {
        "metadata": {
            "abstract": "test",
            "motivation": "test",
            "rationale": "test",
            "references": [
                "https://test.com/"
            ],
            "title": "test"
        },
        "valid": true
    }
}
--------------------


OK - response ok, status ok, for case: URL ok, corrupted hash aa: expected: INCORRECT_HASH 
Inputs:
 {
    "url": "https://raw.githubusercontent.com/mpawel79/testrepo/master/InfoJune03.jsonld",
    "hash": "aabfff0e2213ff0c5331e6d9d99d47a5a825dce7053671b6ed4daae4b4e0df5e"
}
Response code: 200
{
    "status": null,
    "valid": false,
    "raw": {
        "metadata": {
            "abstract": "test",
            "motivation": "test",
            "rationale": "test",
            "references": [
                "https://test.com/"
            ],
            "title": "test"
        },
        "status": "INVALID_HASH",
        "valid": false
    }
}
--------------------


OK - response ok, status ok, for case: URL ok, empty hash, expected: INCORRECT_HASH
Inputs:
 {
    "url": "https://raw.githubusercontent.com/mpawel79/testrepo/master/InfoJune03.jsonld",
    "hash": ""
}
Response code: 200
{
    "status": null,
    "valid": false,
    "raw": {
        "metadata": {
            "abstract": "test",
            "motivation": "test",
            "rationale": "test",
            "references": [
                "https://test.com/"
            ],
            "title": "test"
        },
        "status": "INVALID_HASH",
        "valid": false
    }
}
--------------------


OK - response ok, status ok, for case: URL to not existing file, hash ok: expected: URL_NOT_FOUND
Inputs:
 {
    "url": "https://raw.githubusercontent.com/mpawel79/testrepo/master/NOT_EXISTS.jsonld",
    "hash": "eebfff0e2213ff0c5331e6d9d99d47a5a825dce7053671b6ed4daae4b4e0df5e"
}
Response code: 200
{
    "status": null,
    "valid": false,
    "raw": {
        "status": "URL_NOT_FOUND",
        "valid": false
    }
}
--------------------


OK - response not ok, status ok, for case: Empty URL, empty hash, expected: response - an error code
Inputs:
 {
    "url": "",
    "hash": ""
}
Response code: 200
{
    "status": null,
    "valid": false,
    "raw": {
        "status": "URL_NOT_FOUND",
        "valid": false
    }
}
--------------------

Below tracked in issue #1150:

NOT OK, TBC - response is 200, status is null but hash is not for provied json, for case: URL to other json (drep format), hash ok - expected: INCORRECT_JSONLD
Inputs:
 {
    "url": "https://github.com/mpawel79/testrepo/blob/master/PawelDrep.jsonld",
    "hash": "eebfff0e2213ff0c5331e6d9d99d47a5a825dce7053671b6ed4daae4b4e0df5e"
}
Response code: 200
{
    "status": null,
    "valid": false,
    "raw": {
        "valid": true
    }
}
--------------------


NOT OK - response not ok, status not ok, for case: valid URL to corrupted json, hash ok - expected: INCORRECT_JSONLD
Inputs:
 {
    "url": "https://raw.githubusercontent.com/mpawel79/testrepo/master/test_INVALID_JSON_FORMAT.jsonld",
    "hash": "eebfff0e2213ff0c5331e6d9d99d47a5a825dce7053671b6ed4daae4b4e0df5e"
}
Response code: 200
{
    "status": null,
    "valid": false,
    "raw": {
        "valid": true
    }
}
--------------------


NOT OK - response ok, status not given - some other error msg, for INCORRECT_HASH not resturned,  URL ok, corrupted hash to long: expected: INCORRECT_HASH
Inputs:
 {
    "url": "https://raw.githubusercontent.com/mpawel79/testrepo/master/InfoJune03.jsonld",
    "hash": "CORRUPTED_eebfff0e2213ff0c5331e6d9d99d47a5a825dce7053671b6ed4daae4b4e0df5e"
}
Response code: 400
{
    "combinator": "ReqBody'",
    "error": "Error in $.hash: mzero"
}
--------------------



Click to add a cell.

OK - no error 500 was returned

TBC - status - for postive case - nothing returned when all is fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants