Skip to content

Permission validation errors are opaque #2276

@slifty

Description

@slifty

@bickelj pointed this out in an earlier review but I didn't properly make an issue.

Right now because of how our schema validation works our permission grant API responds with very confusing messages about what is wrong (basically it is returning all possible validation errors for all possible types of permission grant, which is profoundly unhelpful).

This needs to be resolved; it may be that the core problem is that shema shape is not the right place to encode value validation (e.g. the schema doesn't need to define what combinations of values / attributes are expected). That said, there may be other solutions too.

Here's an example of what I mean by opaque:

{
  "name": "InputValidationError",
  "message": "Invalid request body.",
  "details": [
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/0/required",
      "keyword": "required",
      "params": {
        "missingProperty": "funderShortCode"
      },
      "message": "must have required property 'funderShortCode'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/1/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "/granteeUserKeycloakUserId",
      "schemaPath": "#/oneOf/2/properties/granteeUserKeycloakUserId/format",
      "keyword": "format",
      "params": {
        "format": "uuid"
      },
      "message": "must match format \"uuid\""
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/3/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/4/required",
      "keyword": "required",
      "params": {
        "missingProperty": "dataProviderShortCode"
      },
      "message": "must have required property 'dataProviderShortCode'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/5/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/6/required",
      "keyword": "required",
      "params": {
        "missingProperty": "opportunityId"
      },
      "message": "must have required property 'opportunityId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/7/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/8/required",
      "keyword": "required",
      "params": {
        "missingProperty": "proposalId"
      },
      "message": "must have required property 'proposalId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/9/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/10/required",
      "keyword": "required",
      "params": {
        "missingProperty": "proposalVersionId"
      },
      "message": "must have required property 'proposalVersionId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/11/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/12/required",
      "keyword": "required",
      "params": {
        "missingProperty": "applicationFormId"
      },
      "message": "must have required property 'applicationFormId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/13/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/14/required",
      "keyword": "required",
      "params": {
        "missingProperty": "applicationFormFieldId"
      },
      "message": "must have required property 'applicationFormFieldId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/15/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/16/required",
      "keyword": "required",
      "params": {
        "missingProperty": "proposalFieldValueId"
      },
      "message": "must have required property 'proposalFieldValueId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/17/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/18/required",
      "keyword": "required",
      "params": {
        "missingProperty": "sourceId"
      },
      "message": "must have required property 'sourceId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/19/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/20/required",
      "keyword": "required",
      "params": {
        "missingProperty": "bulkUploadTaskId"
      },
      "message": "must have required property 'bulkUploadTaskId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/21/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/22/required",
      "keyword": "required",
      "params": {
        "missingProperty": "changemakerFieldValueId"
      },
      "message": "must have required property 'changemakerFieldValueId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf/23/required",
      "keyword": "required",
      "params": {
        "missingProperty": "granteeKeycloakOrganizationId"
      },
      "message": "must have required property 'granteeKeycloakOrganizationId'"
    },
    {
      "instancePath": "",
      "schemaPath": "#/oneOf",
      "keyword": "oneOf",
      "params": {
        "passingSchemas": null
      },
      "message": "must match exactly one schema in oneOf"
    }
  ]
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions