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

Add static schema.json for Inngest config JSON Schema typing #231

Merged
merged 4 commits into from
Aug 26, 2022

Conversation

jpwilliams
Copy link
Member

@jpwilliams jpwilliams commented Aug 25, 2022

Summary

Adds a static schema.json in the root directory to be used to provide type hinting and validation to users while creating/editing Inngest config files.

{
  "$schema": "https://raw.githubusercontent.com/inngest/inngest/main/schema.json",
  // other usual props...
}

We could also refer to specific versions of the schema, though I think it makes sense to target main so we're looking at the very latest valid version.

{
  "$schema": "https://raw.githubusercontent.com/inngest/inngest/v0.5.5/schema.json",
  // other usual props...
}

I'd love to generate this directly from pkg/cuedefs/v1/function.cue, but our path to conversion doesn't yet support comments - see cue-lang/cue#1180. The comments are crucial to fulfil the purpose of teaching the user through tooling, hence the static version.

We could potentially introduce a very simple Dangerfile to prompt in PRs if function.cue is changed and schema.json is not to ensure they're kept in sync until cue-lang/cue#1180 is resolved.

Next

@jpwilliams jpwilliams self-assigned this Aug 25, 2022
Copy link
Contributor

@tonyhb tonyhb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty amazing! Definitely a huge fan of adding these kinds of type hints.

@jpwilliams jpwilliams merged commit 6e6ce7e into main Aug 26, 2022
@jpwilliams jpwilliams deleted the config-json-schema branch August 26, 2022 16:38
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

Successfully merging this pull request may close these issues.

2 participants