You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop-docs/backend/api/public.mdx
+74Lines changed: 74 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -410,6 +410,79 @@ will be triggered to make your changes automatically go live:
410
410
makes and merges a PR in `sentry-docs`, which kicks off a deploy via Vercel to
411
411
https://docs.sentry.io/api/.
412
412
413
+
## Troubleshooting API Docs Tests
414
+
415
+
NOTE: The `openapi-diff` test is supposed to fail when CI runs on your pull request as it is meant to highlight the schema changes. It is not required to merge.
416
+
417
+
**Problem**: `TypeError: Cannot read properties of null (reading 'type')`
418
+
419
+
**Solution**: If you have a `ChoiceField` that can be null, make sure you're using the right option. `allow_blank` should be used for textual choices, while `allow_null` should be used for numeric and other non-textual choices.
420
+
421
+
---
422
+
423
+
**Problem**: `must have required property '<property_name>'`
424
+
```json
425
+
{
426
+
"type": "Validation",
427
+
"message": "must have required property '<property_name>'",
428
+
"instancePath": "",
429
+
"schemaPath": "#/required",
430
+
"keyword": "required",
431
+
"params": {
432
+
"missingProperty": "<property_name>"
433
+
},
434
+
"examplePath": "<endpoint_path>"
435
+
}
436
+
```
437
+
438
+
**Solution**: Your example response is missing the required property `<property_name>` which is specified by the response class. `<property_name>` should either be made optional in the response class or added to the example response.
439
+
440
+
---
441
+
442
+
**Problem**: `must NOT have additional properties`
443
+
```json
444
+
{
445
+
"type": "Validation",
446
+
"message": "must NOT have additional properties",
447
+
"instancePath": "",
448
+
"schemaPath": "#/additionalProperties",
449
+
"keyword": "additionalProperties",
450
+
"params": {
451
+
"additionalProperty": "<property_name>"
452
+
},
453
+
"examplePath": "<endpoint_path>"
454
+
}
455
+
```
456
+
457
+
**Solution**: Your example response includes a property with `<property_name>` that is not included in the response class. This either needs to be added to the response class or removed from the example.
**Solution**: The type of the value for a property in your example response does not match the type for the property specified by the response class. The example value or the type of the property in the response class should be fixed.
477
+
478
+
---
479
+
480
+
**Problem**: `sentry.apidocs.utils.SentryApiBuildError: projects is not defined by OPENAPI_TAGS in src/sentry/apidocs/build.py for <endpoint title>`
481
+
482
+
**Solution**: You need to add the endpoint to a [sidebar tab](/backend/api/public/#3-sidebar-tab) with the decorator `@extend_schema(tags=['<section title>'])`.
483
+
484
+
---
485
+
413
486
## Requesting an API to be public
414
487
415
488
Are you a Sentry user who wants an endpoint to be public?
@@ -423,6 +496,7 @@ and add the `Component: API` label.
423
496
The team responsible for the endpoint will review the stability of the endpoint. If the endpoint
424
497
will not have breaking changes in future, they can determine whether to make it public.
0 commit comments