Skip to content

Provide non-source-location context for errors in schema parsing #435

Open

Description

@john-h-kastner-aws

Category

Cedar validation features

Describe the feature you'd like to request

When schema construction fails we currently do not have a good way to report source locations if it fails after serde finishes the initial parse from JSON (#174). We should instead (or in addition) report more information about the context of the error, including at least the entity type, common type, or action where the error occurred.

For example, all of these errors are difficult to diagnose, particularly in a large schema because the message gives no indication of where to look for the error.

For this error we should report that the error occurred in `memberOfTypes` list for `User` entity type instead of just in entity type.

{
  "": {
    "entityTypes": {
      "User": {
        "memberOfTypes": [""]
      }
    },
    "actions": {}
  }
}

This should also work for a parse error in the entity type itself, so this could say parsing name of `My Entity Type` entity type.

{
  "": {
    "entityTypes": {
      "My Entity Type": {}
    },
    "actions": {}
  }
}

And for a common type name. This could be: parsing name of `My Common Type` common type.

{
  "MyNameSpace": {
    "commonTypes": {
      "My Common Type": {
        "type": "String"
      }
    },
    "entityTypes": {},
    "actions": {}
  }
}

See #349 for more errors that could be improved.

Activity

  1. added
    pending-triageThe cedar maintainers haven't looked at this yet. Automicaly added to all new issues.
    feature-requestThis issue requets a substantial new feature
    help-wantedCommunity help desired. We have not scheduled time to fix this, but think it important.
    and removed
    pending-triageThe cedar maintainers haven't looked at this yet. Automicaly added to all new issues.
    help-wantedCommunity help desired. We have not scheduled time to fix this, but think it important.
    on Nov 15, 2023
  2. added
    papercutSmall annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a feature request
    on Jan 5, 2024
  3. changed the title [-]Provide non-source-location context for errors is schema parsing[/-] [+]Provide non-source-location context for errors in schema parsing[/+] on Mar 27, 2024
  4. removed
    papercutSmall annoyances in the Cedar SDK. Lower priority fixes than bugs. Smaller than a feature request
    on Oct 2, 2024
  5. added a commit that references this issue on May 20, 2025
  6. added a commit that references this issue on Oct 25, 2026
    e899db3
  7. Vedthakar commented on Oct 25, 2026

    @Vedthakar
    Contributor

    I opened #2650 for this: errors while reading a JSON schema are now prefixed with the declaration they come from, e.g. in entity type \User`: ...`.

    — Ved Thakar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestThis issue requets a substantial new feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions