sfcc/no-custom-api-additional-properties
Disallows additionalProperties in Custom API request body schemas.
What it checks
- Resolves the
api.jsonin the same directory as the linted file and, for every endpoint entry whoseimplementationresolves to the linted file, loads the referenced OAS 3.0schema.yaml - Finds the operation matching the endpoint's
operationIdand resolves itsrequestBody(including$ref) - Recursively scans the request body schema (
properties,items,$ref) for anyadditionalPropertieskeyword - Applies only to JavaScript-like inputs:
.js,.mjs,.cjs,.ds, and<input> - Has no effect on files that are not referenced as an
implementationby anyapi.json
Why this rule exists
Salesforce B2C Commerce does not register a Custom API endpoint whose request body schema contains additionalProperties, at any nesting level. That failure is only visible at code-version activation time. This rule surfaces the same restriction directly through ESLint.
Default behavior
- Severity:
error - Auto-fix: none
Example
Invalid: schema.yaml
yaml
requestBody:
content:
application/json:
schema:
type: object
additionalProperties: true
properties:
points:
type: numberValid: schema.yaml
yaml
requestBody:
content:
application/json:
schema:
type: object
properties:
points:
type: number