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

JSON Validation and Editing Improvements #2389

Merged
merged 25 commits into from May 18, 2024
Merged

JSON Validation and Editing Improvements #2389

merged 25 commits into from May 18, 2024

Conversation

jdorn
Copy link
Member

@jdorn jdorn commented Apr 14, 2024

Background

We currently support JSON Schema to validate feature values, but JSON Schema is very difficult to write from scratch unless you are very familiar with it.

Also, when editing a JSON feature's value, we just render a simple textarea instead of taking the JSON Schema into account (e.g. if the schema says it's an object with a two string fields, we should render two text inputs, not a single textarea).

Features and Changes

This PR has 4 main changes:

  1. If you have an existing JSON feature flag and go to add validation, we will infer the schema from the default value so you don't need to enter it from scratch
  2. Added a new Simple Schema option for validation as an easier alternative to working with JSON Schemas (it compiles to JSON Schema under-the-hood)
  3. Added a new easy-to-use JSON editing interface for feature values when Simple Schema validation is enabled
  4. When entering JSON feature values manually, there is a new "format" link to fix any typos/formatting errors

TODO:

  • Updated UI to show current validation settings on the feature page
  • GUI for defining simple schemas (+ unit tests converting to JSON Schema)
  • When adding validation to a feature for the first time, try to infer the initial simple schema from the feature's default value (+ unit tests)
  • New editing UI for entering feature values when there's a simple schema
    • Default value
    • Force rule value
    • Rollout rule value
    • Experiment rule variation values (in RuleModal)
    • Experiment rule variation values (from experiment page)
  • Add screenshots to PR
  • Documentation

@jdorn jdorn changed the title Simple JSON feature validation JSON Validation and Editing Improvements Apr 18, 2024
@jdorn jdorn marked this pull request as ready for review May 17, 2024 03:55
Copy link

Your preview environment pr-2389-bttf has been deployed.

Preview environment endpoints are available at:

@jdorn jdorn merged commit 7d40fde into main May 18, 2024
4 checks passed
@jdorn jdorn deleted the simple-feature-schemas branch May 18, 2024 16:24
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.

None yet

1 participant