| 1 | // The package is intended for testing the openapi-gen API rule |
| 2 | // checker. The API rule violations are in format of: |
| 3 | // |
| 4 | // `{rule-name},{package},{type},{(optional) field}` |
| 5 | // |
| 6 | // The checker should sort the violations before |
| 7 | // reporting to a file or stderr. |
| 8 | // |
| 9 | // We have the dummytype package separately from the listtype |
| 10 | // package to test the sorting behavior on package level, e.g. |
| 11 | // |
| 12 | // -i "./testdata/listtype,./testdata/dummytype" |
| 13 | // -i "./testdata/dummytype,./testdata/listtype" |
| 14 | // |
| 15 | // The violations from dummytype should always come first in |
| 16 | // report. |
| 17 | |
| 18 | package dummytype |
| 19 | |
| 20 | // +k8s:openapi-gen=true |
| 21 | type Foo struct { |
| 22 | Second string |
| 23 | First int |
| 24 | } |
| 25 | |
| 26 | // +k8s:openapi-gen=true |
| 27 | type Bar struct { |
| 28 | ViolationBehind bool |
| 29 | Violation bool |
| 30 | } |
| 31 | |
| 32 | // +k8s:openapi-gen=true |
| 33 | type Baz struct { |
| 34 | Violation bool |
| 35 | ViolationBehind bool |
| 36 | } |
| 37 | |
| 38 | // +k8s:openapi-gen=true |
| 39 | type StatusError struct { |
| 40 | Code int |
| 41 | Message string |
| 42 | } |