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

Compatibility with the 1.0 spec #14

Open
jklmnn opened this issue May 4, 2023 · 3 comments
Open

Compatibility with the 1.0 spec #14

jklmnn opened this issue May 4, 2023 · 3 comments

Comments

@jklmnn
Copy link
Collaborator

jklmnn commented May 4, 2023

I set up a local instance and checked it with my validator however it returned that the index is not valid. I haven't looked into the details yet however I think this is something we need to fix before a productive use.
@hbruch

You can validate it by running:

./validate.py http://localhost:8000/api/
@hbruch
Copy link
Collaborator

hbruch commented Oct 21, 2023

Reason (at least one) is, that ParkAPI2 does not return source for some pools:

$ python validate.py http://api.localhost/api
ERROR:root:message
Traceback (most recent call last):
  File ".../parkendd-status/validate.py", line 53, in index_is_valid
    jsonschema.validate(data, self.indexschema)
  File ".../site-packages/jsonschema/validators.py", line 934, in validate
    raise error
jsonschema.exceptions.ValidationError: None is not of type 'string'

Failed validating 'type' in schema['properties']['cities']['patternProperties']['[A-Z][a-z]*']['properties']['source']:
    {'type': 'string'}

On instance['cities']['Bielefeld']['source']:
    None
{'status': 200, 'index': 'invalid'}

I suggest to return public_url (which should be the url used for scraping) in case no source_url is defined.

@hbruch
Copy link
Collaborator

hbruch commented Oct 21, 2023

Besides this, last_updated is not returned and for some parkings free is returned with value None.
However, the validator' city_schema does not match exactly ParkAPI's city_schema. I.e. ParkAPI1 does not require free, while validator does.

last_updated should be returned, and if free is unknown, it should not.

On instance['last_updated']:
    None
ERROR:root:message
Traceback (most recent call last):
  File ".../parkendd-status/validate.py", line 62, in city_is_valid
    jsonschema.validate(data, self.cityschema)
  File ".../site-packages/jsonschema/validators.py", line 934, in validate
    raise error
jsonschema.exceptions.ValidationError: None is not of type 'string'

Failed validating 'type' in schema['properties']['last_updated']:
    {'type': 'string'}

On instance['last_updated']:
    None
ERROR:root:message
Traceback (most recent call last):
  File ".../parkendd-status/validate.py", line 62, in city_is_valid
    jsonschema.validate(data, self.cityschema)
  File ".../site-packages/jsonschema/validators.py", line 934, in validate
    raise error
jsonschema.exceptions.ValidationError: None is not of type 'integer'

Failed validating 'type' in schema['properties']['lots']['items']['properties']['free']:
    {'type': 'integer'}

On instance['lots'][1]['free']:
    None

@jklmnn
Copy link
Collaborator Author

jklmnn commented Nov 1, 2023

ParkAPI1 does not require free, while validator does.

We should assume that it does require free, otherwise applications may break. If it creates output that does not include free that is a bug. In the case of nodata free should be set to 0.

last_updated should be returned, and if free is unknown, it should not.

last_updated is a property of a city while free is a property of a single lot. So we always have to supply last_updated.

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