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
print_r($e->errors()); // structured array of errors keyed by JSON pointer
161
160
exit(1);
162
161
}
163
162
@@ -261,15 +260,24 @@ Most objects provide named constructors so you rarely need `new`. Here's a quick
261
260
262
261
## Working with References
263
262
264
-
`Reference::to()` creates a `$ref` to any component registered in `Components`. On the target class itself, `ref()` is a type-safe shortcut.
263
+
`Reference::to()` creates a `$ref` to any component registered in `Components`. Typed named constructors on `Reference` build the correct pointer automatically — no need to write out the full path.
265
264
266
265
```php
267
266
use Cortex\OpenApi\Objects\Reference;
268
267
269
-
// Generic reference — works for anything
268
+
// Typed shortcuts — recommended, construct the $ref path automatically
For multiple content types or non-JSON bodies, use `->content()` with explicit `MediaType` objects (see [MediaType](#mediatype) below).
43
+
34
44
### required
35
45
36
46
Mark the body required when clients must always send it. Optional bodies (the default) are used for partial updates or endpoints where the payload is situational.
@@ -206,8 +216,8 @@ use Cortex\OpenApi\Objects\Reference;
@@ -68,16 +67,27 @@ Use `Response::default()` to cover all error codes with a single error schema ra
68
67
69
68
### Response Content
70
69
71
-
Attach one or more `MediaType` objects to document the response body:
70
+
Attach one or more `MediaType` objects to document the response body. The `->json()` shortcut handles the common case of a single JSON content type in one call:
0 commit comments