SpaceApi / validator

A micro-service to validate SpaceAPI endpoints.
Apache License 2.0
2 stars 2 forks source link

When an invalid endpoint URL or JSON object is provided, no error is shown #64

Open jabelone opened 9 months ago

jabelone commented 9 months ago

Heya, after testing a potential fix related to this issue, I noticed that the validator showed no feedback in the UI when it failed to pass the data from that endpoint. This is confusing and makes me think that the validator is "broken" when really it just needs to throw up an error saying the endpoint couldn't be parsed because it's response doesn't follow the specification.

The endpoint in question will shortly be fixed, so I've included the problematic JSON response that triggers this behaviour below for testing purposes. Changing the api_compatibility version from "0.14" to "14" causes it to parse correctly and show a different, unrelated error in the validator UI.

{
    "space": "Brisbane Makerspace",
    "logo": "https://brisbanemaker.space/wp-content/uploads/2021/10/BMS-Logo-ONLY.png",
    "url": "https://brisbanemaker.space/",
    "contact": {
        "email": "[hello@brisbanemaker.space](mailto:hello@brisbanemaker.space)",
        "twitter": "",
        "phone": "",
        "facebook": ""
    },
    "spacefed": {
        "spacenet": false,
        "spacesaml": false,
        "spacephone": false
    },
    "projects": [],
    "issue_report_channels": [
        "email"
    ],
    "state": {
        "open": false,
        "message": "Welcome to BMS!",
        "lastchange": 1699966832.295935
    },
    "icon": {
        "open": "https://brisbanemaker.space/wp-content/uploads/2021/10/favicon.png",
        "closed": "https://brisbanemaker.space/wp-content/uploads/2021/10/favicon.png"
    },
    "api_compatibility": [
        "0.14"
    ],
    "sensors": {
        "total_member_count": {
            "value": 62
        },
        "people_now_present": {
            "value": 0
        }
    },
    "location": {
        "address": "146 Wickham St, Fortitude Valley, QLD 4006 Australia",
        "lat": -27.458819,
        "lon": 153.032185
    }
}
dbrgn commented 9 months ago

The problem is in the v2 API endpoint itself. I'll investigate.

dbrgn commented 9 months ago

Validation is delegated to https://github.com/spaceapi-community/go-spaceapi-validator, which simply returns the error EOF. The problem should get fixed in https://github.com/spaceapi-community/go-spaceapi-validator/pull/2

Additionally, the UI should properly handle API responses. Right now, nothing happens. However, I can't seem to find the source code of the validator UI, it's not part of this repository 😂 @gidsi could you help out?

dbrgn commented 7 months ago

Validator web UI is here: https://github.com/spaceapi-community/validator-web

psy0rz commented 2 months ago

ah i see, thanks!:)