Closed sethvincent closed 4 years ago
Thanks for this @sethvincent! I don't have any feedback on the content, but just wanted to mention we're already using https://www.npmjs.com/package/jsonschema for other OpenAQ projects. If possible, it'd be nice to avoid duping schema packages, but if you really want to use this one, just give a reason why and it's not a problem.
Ah, I hadn't seen that. Switching to jsonschema makes sense to me.
Updated to use jsonschema and added a fix for a missing schema property.
I realized that the locations table/endpoint uses parameters
instead of pollutants
so it would probably be best to use parameters
here as well. I'll take a look through and see if there are any other similar mismatches.
This adds a json schema for locations & associated instruments, and includes initial implementation of a node module that exposes the location schema and a
validate
function. This will allow us to write tests against the schema and/or use the schema as a dependency for validating api requests, generating test data, etc.The schema is based on discussion in https://github.com/openaq/project-metadata-format/issues/7, some editing may be needed.
I considered breaking the
instrument
schema out into its own file but it didn't seem like there was a use case for having it separate.The docs in
docs/location.md
are generated by runningnpm run build
.