Commit da18a85
authored
Fix: Renderers fail when processing range HTTP status code such as '2XX' (#397)
Both Markdown and Console renderer fail when trying to process a range HTTP status code, e. g. '2XX'. So any diff that results in an output including such a status code fails to render for markdown and console.
The error occurs when trying to parse the String HTTP status code into an Integer right here (both in Markdown and Console renderer):
```java
if (!code.equals("default")) {
// Integer.parseInt(code) fails when passing e. g. '2XX'
status = HttpStatus.getReasonPhrase(Integer.parseInt(code));
}
```
JSON and HTML renderer are not affected, since they do not try to display the 'reason phrase'. Everything else, the actual diff process etc. is also not affected.
# Expected behavior
Expected ranges of HTTP status codes, like '2XX' covering all codes between 200-299, to be treated like any other HTTP status code, since they have been part of the OpenAPI specification since version [3.0.0](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#patterned-fields-1).1 parent f96f35d commit da18a85
File tree
6 files changed
+38
-2
lines changed- core/src
- main/java/org/openapitools/openapidiff/core/output
- test
- java/org/openapitools/openapidiff/core
- resources
6 files changed
+38
-2
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
17 | 25 | | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
24 | 32 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments