Skip to content

Respond 4xx when parameters are unrecognised #286

Open
@leandro-cavalcante

Description

@leandro-cavalcante

Description

As The message errors of the end point /policy-content are generic, The time for the user to find which parameter or value is missing can take longer time,

I want To provide the to the user specific error messages for missing parameters or wrong values,

so that can lead to a clear understanding on how to use the Policy Hub API

Acceptance Criteria

HTTP 400 Bad Request:

  • [Missing mandatory query parameters (e.g., type, policyName, operatorType not provided)]
  • [Invalid useCase parameter format]
  • [Invalid type parameter format]
  • [Invalid policyName parameter format]
  • [Invalid operatorType parameter; expected values not met (e.g., not 'Equals', 'Contains', etc.)]
  • [Invalid value parameter format]

HTTP 404 Not Found:

  • [The endpoint itself does not exist]
  • [The specified policyName is not supported]
  • [The specified useCase is not supported]
  • [The specified type is not supported]
  • [The specified operatorType is not supported]
  • [The specified value is not supported ]

Additional Information

i.e 400 error message:
{ "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1", "title": "One or more validation errors occurred.", "status": 400, "errors": { "unknown": [ "Invalid values [111] set for key UsagePurpose. Possible values [cx.core.digitalTwinRegistry:1]" ] }, "errorId": "f5bddb28-72c2-4a30-ac86-aff5212cb74e", "details": [] }

i.e 404 message error:
{ "type": "https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.4", "title": "Cannot find representation of target resource.", "status": 404, "errors": { "Org.Eclipse.TractusX.PolicyHub.Service": [ "Missing required parameters: type." ] }, "errorId": "c314f6ca-8419-4650-ad92-70444a811447", "details": [] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    NEW USER REQUEST

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions