Skip to content

Commit d4b2bad

Browse files
committed
docs(appsec): enhance schema comparison section in API Endpoints page
Expanded the comparison of declared and inferred schemas by adding severity levels and detailed descriptions of potential differences. Included specific areas of schema changes that can occur and clarified which differences are excluded to reduce noise. This improves the clarity and usability of the documentation for users comparing API schemas.
1 parent 5a46b2e commit d4b2bad

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

  • content/en/security/application_security/api_posture/api_inventory

content/en/security/application_security/api_posture/api_inventory/api_endpoints.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,36 @@ When the endpoint is associated with an API in Datadog Software Catalog, the dis
143143

144144
To reduce noise, the inferred schema includes fields that are observed reliably over time and leaves out one-off or rarely seen fields, so the differences reported reflect meaningful drift rather than transient traffic.
145145

146-
## Compare *declared* and *inferred* schemas
146+
### Compare *declared* and *inferred* schemas
147147

148148
To compare schemas, set up the following:
149149

150150
- To view an inferred schema, [enable App and API Protection][9] on the service so endpoints are discovered from live traffic.
151151
- To compare against a declared schema, register the API's OpenAPI definition in the Datadog Catalog. See [Create Entities][8].
152152

153-
The differences are highlighted by severity.
153+
The differences are highlighted by severity:
154+
155+
| Severity | Meaning |
156+
|----------|---------|
157+
| Breaking | The change likely breaks clients that rely on the declared contract, such as a field that became required or a parameter type change. |
158+
| Warning | The change is drift worth reviewing, such as an undeclared field observed in traffic or a parameter that became optional. |
159+
| Info | The difference is low-risk, such as an endpoint that is declared but has no observed traffic. |
160+
161+
Differences can appear in the following areas of the schema:
162+
163+
- **Parameters**: A parameter added, removed, or changed from optional to required (or the reverse).
164+
- **Request body**: A request body added, removed, or changed from optional to required (or the reverse).
165+
- **Schema properties**: A property added, removed, changed from optional to required (or the reverse), or changed type, format, nullability, or enum values.
166+
- **Value constraints**: Changes to numeric or length limits (`minimum`, `maximum`, `minLength`, `maxLength`), patterns, or uniqueness constraints.
167+
- **Schema composition**: A mismatch in `oneOf` or `allOf` composition, or in a discriminator.
168+
- **Responses**: A status code, response header, or content type added or removed.
169+
170+
To reduce noise, some differences are excluded because they don't represent meaningful contract drift:
171+
172+
- Request header and cookie parameters, since they often carry values such as authentication tokens or session identifiers that aren't part of the API contract.
173+
- Type changes on query parameters, since query parameters are always observed as strings in traffic, even when declared as another type, such as an integer or boolean.
174+
- Removed status codes, since the inferred schema only includes status codes observed in traffic, so a declared status code that hasn't occurred yet during observation always appears as removed.
175+
- `anyOf` composition mismatches, since the declared and inferred schemas can use `anyOf` at different levels of the schema while remaining equivalent.
154176

155177
## Processing sensitive data
156178

0 commit comments

Comments
 (0)