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

Improve validation error message #64

Open
beeme1mr opened this issue Dec 9, 2024 · 0 comments
Open

Improve validation error message #64

beeme1mr opened this issue Dec 9, 2024 · 0 comments

Comments

@beeme1mr
Copy link
Member

beeme1mr commented Dec 9, 2024

Errors in the flag manifest are not presented in a user-friendly way. Improve the output so users can more easily understand how to address the issue.

Current output:

Error: error loading flag manifest: error validating JSON schema: jsonschema: '/flags/offer-free-shipping' does not validate with file:///home/nonroot/github.com/open-feature/cli/docs/schema/v0/flag_manifest.json#/properties/flags/patternProperties/%5E.%7B1%2C%7D$/$ref/required: missing properties: 'flagType', 'defaultValue'
error loading flag manifest: error validating JSON schema: jsonschema: '/flags/offer-free-shipping' does not validate with file:///home/nonroot/github.com/open-feature/cli/docs/schema/v0/flag_manifest.json#/properties/flags/patternProperties/%5E.%7B1%2C%7D$/$ref/required: missing properties: 'flagType', 'defaultValue'
Usage:
  openfeature generate react [flags]

Flags:
  -h, --help   help for react

Global Flags:
      --flag_manifest_path string   Path to the flag manifest.
      --output_path string          Output path for the codegen

Using the following manifest:

{
  "$schema": "https://flagd.dev/schema/v0/flags.json",
  "flags": {
    "offer-free-shipping": {
      "state": "ENABLED",
      "variants": {
        "on": true,
        "off": false
      },
      "defaultVariant": "on"
    },
    "sticky-header": {
      "state": "ENABLED",
      "variants": {
        "on": true,
        "off": false
      },
      "defaultVariant": "on",
      "targeting": {
        "if": [{ "==": [{ "var": "size" }, "sm"]}, "on", null ]
      }
    },
    "use-distributed-db": {
      "state": "ENABLED",
      "variants": {
        "on": true,
        "off": false
      },
      "targeting": {
        "fractional": [
          ["on", 0],
          ["off", 100]
        ]
      },
      "defaultVariant": "off"
    },
    "use-secure-protocol": {
      "state": "ENABLED",
      "variants": {
        "on": true,
        "off": false
      },
      "defaultVariant": "off"
    }
  }
}
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

1 participant