Anypoint Best Practices

(14 reviews)

request-response-antipattern

general > request-response-antipattern


Guidance

Resource schemas should describe the information of the exposed resource, not a Request/Response RPC message wrapper containing the resource and out-of-band information. For example instead of using a schema like `MyResourceRequest` or `MyResourceResponse` use `MyResource`.

Message

'{{shacl.name}}' is using the request/response anti-pattern.

Examples

valid

/endpoint:
  get:
    body:
      application/json:
        type: Person
    responses:
      200:
          body:
            application/json:
              type: Person

invalid

/endpoint:
  get:
    body:
      application/json:
        type: PersonRequest
    responses:
      200:
          body:
            application/json:
              type: PersonResponse # this is an anti-pattern

Applies to NodeShape

Constraint

Type: Declarative Validation

Reviews

TypeRuleset
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onDec 11, 2023
Asset overview

Asset versions for 1.6.x

Asset versions
VersionActions
1.6.1
1.6.0

Tags