sourcegraph/schema
2018-09-30 23:13:36 -07:00
..
extension_stringdata.go Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
extension.schema.json Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
gen.go Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
json-schema.schema.json Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
README.md Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
schema.go Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
settings_stringdata.go Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
settings.schema.json Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
site_stringdata.go Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
site.schema.json Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00
stringdata.go Publish Sourcegraph as open source 🚀 2018-09-30 23:13:36 -07:00

Sourcegraph JSON Schemas

JSON Schema is a way to define the structure of a JSON document. It enables typechecking and code intelligence on JSON documents.

Sourcegraph uses the following JSON Schemas:

  • settings.schema.json
  • site.schema.json
  • datacenter.schema.json
  • extension.schema.json is manually copied to this directory as needed. Only the subset of properties and definitions used by our Go code is needed. The web app uses the extension.schema.json file from the @sourcegraph/extensions-client-common npm package (the Go code currently doesn't use the file from this npm package because that would require running yarn in all Go tests in CI, which would be slow).

Modifying a schema

  1. Edit the *.schema.json file in this directory.
  2. Run go generate to update the *_stringdata.json file.
  3. Commit the changes to both files.
  4. When the change is ready for release, update the documentation.

Known issues

  • The JSON Schema IDs (URIs) are of the form https://sourcegraph.com/v1/*.schema.json#, but these are not actually valid URLs. This means you generally need to supply them to JSON Schema validation libraries manually instead of having the validator fetch the schema from the web.