Skip to content

Commit 2c56845

Browse files
committed
Document allOf wrapper breaking change in UPGRADING.md
1 parent d8a2342 commit 2c56845

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#### Fixes
1818

19-
* [#90](https://github.com/ruby-grape/grape-swagger-entity/pull/90): Fix description not rendered for non-array entity references - [@numbata](https://github.com/numbata).
19+
* [#90](https://github.com/ruby-grape/grape-swagger-entity/pull/90): Fix description not rendered for non-array entity references (see [UPGRADING](UPGRADING.md)) - [@numbata](https://github.com/numbata).
2020
* [#86](https://github.com/ruby-grape/grape-swagger-entity/pull/86): Fix Array[Object] documentation type parsing - [@numbata](https://github.com/numbata).
2121
* [#87](https://github.com/ruby-grape/grape-swagger-entity/pull/87): Remove hidden attributes from required - [@bogdan](https://github.com/bogdan).
2222
* [#88](https://github.com/ruby-grape/grape-swagger-entity/pull/88): Update danger workflows - [@numbata](https://github.com/numbata).

UPGRADING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
## Upgrading grape-swagger-entity
22

3+
### Upgrading to >= 0.7.1
4+
5+
#### Non-Array Entity References Now Use `allOf` Wrapper
6+
7+
This release fixes an issue where `description` and `readOnly` properties were silently
8+
ignored for non-array entity references. The fix wraps `$ref` in an `allOf` array,
9+
which is the correct way to combine `$ref` with sibling properties per OpenAPI/JSON Schema spec.
10+
11+
**Previous Output (invalid OpenAPI - description was ignored):**
12+
```json
13+
{
14+
"user": {
15+
"$ref": "#/definitions/User",
16+
"description": "The author"
17+
}
18+
}
19+
```
20+
21+
**New Output (valid OpenAPI):**
22+
```json
23+
{
24+
"user": {
25+
"allOf": [{ "$ref": "#/definitions/User" }],
26+
"description": "The author"
27+
}
28+
}
29+
```
30+
31+
**Note:** Array entity references are not affected - they already supported sibling
32+
properties via the `items` wrapper.
33+
34+
**Action Required:**
35+
If you have code or tests that parse the raw Swagger/OpenAPI output and expect
36+
`$ref` at the top level for entity references with `description` or `readOnly`,
37+
update them to handle the `allOf` wrapper.
38+
39+
For more details, refer to GitHub Pull Request
40+
[#90](https://github.com/ruby-grape/grape-swagger-entity/pull/90).
41+
342
### Upgrading to >= 0.7.0
443

544
#### Entity Fields Required by Default

0 commit comments

Comments
 (0)