|
| 1 | +openapi: 3.0.0 |
| 2 | +info: |
| 3 | + title: Test API |
| 4 | + version: 1.0.0 |
| 5 | +paths: |
| 6 | + /pets: |
| 7 | + get: |
| 8 | + summary: List all pets |
| 9 | + parameters: |
| 10 | + - $ref: '#/components/parameters/ParamUsed' |
| 11 | + responses: |
| 12 | + '200': |
| 13 | + description: A list of pets |
| 14 | + headers: |
| 15 | + X-RateLimit: |
| 16 | + $ref: '#/components/headers/HeaderUsed' |
| 17 | + content: |
| 18 | + application/json: |
| 19 | + schema: |
| 20 | + type: array |
| 21 | + items: |
| 22 | + $ref: '#/components/schemas/SchemaUsed' |
| 23 | + examples: |
| 24 | + petExample: |
| 25 | + $ref: '#/components/examples/ExampleUsed' |
| 26 | + post: |
| 27 | + summary: Add a new pet |
| 28 | + requestBody: |
| 29 | + $ref: '#/components/requestBodies/RequestBodyUsed' |
| 30 | + responses: |
| 31 | + '201': |
| 32 | + $ref: '#/components/responses/ResponseUsed' |
| 33 | + /users: |
| 34 | + get: |
| 35 | + summary: Get all users |
| 36 | + responses: |
| 37 | + '200': |
| 38 | + description: OK |
| 39 | + content: |
| 40 | + application/json: |
| 41 | + schema: |
| 42 | + # — directly referenced in a path |
| 43 | + $ref: '#/components/schemas/User' |
| 44 | +components: |
| 45 | + schemas: |
| 46 | + User: |
| 47 | + type: object |
| 48 | + properties: |
| 49 | + id: |
| 50 | + type: integer |
| 51 | + name: |
| 52 | + type: string |
| 53 | + # — Not referenced in any path. |
| 54 | + InvisibleParent: |
| 55 | + type: object |
| 56 | + properties: |
| 57 | + # ...but references another schema |
| 58 | + child: |
| 59 | + $ref: '#/components/schemas/InvisibleChild' |
| 60 | + InvisibleChild: |
| 61 | + type: object |
| 62 | + properties: |
| 63 | + foo: |
| 64 | + type: string |
| 65 | + # — used directly by /pets GET and by RequestBodyUsed |
| 66 | + SchemaUsed: |
| 67 | + type: object |
| 68 | + properties: |
| 69 | + id: |
| 70 | + type: integer |
| 71 | + # — never referenced anywhere → direct unused |
| 72 | + SchemaUnused: |
| 73 | + type: object |
| 74 | + properties: |
| 75 | + foo: |
| 76 | + type: string |
| 77 | + # — a chain of refs to test transitive removal: |
| 78 | + SchemaChain1: |
| 79 | + allOf: |
| 80 | + - $ref: '#/components/schemas/SchemaChain2' |
| 81 | + SchemaChain2: |
| 82 | + allOf: |
| 83 | + - $ref: '#/components/schemas/SchemaChain3' |
| 84 | + SchemaChain3: |
| 85 | + allOf: |
| 86 | + - $ref: '#/components/schemas/SchemaChain4' |
| 87 | + SchemaChain4: |
| 88 | + type: object |
| 89 | + properties: |
| 90 | + bar: |
| 91 | + type: boolean |
| 92 | + responses: |
| 93 | + # — used by POST /pets |
| 94 | + ResponseUsed: |
| 95 | + description: Created successfully |
| 96 | + # — never referenced → direct unused |
| 97 | + ResponseUnused: |
| 98 | + description: This one’s not used |
| 99 | + parameters: |
| 100 | + # — used by GET /pets |
| 101 | + ParamUsed: |
| 102 | + name: status |
| 103 | + in: query |
| 104 | + schema: |
| 105 | + type: string |
| 106 | + # — never referenced → direct unused |
| 107 | + ParamUnused: |
| 108 | + name: unusedParam |
| 109 | + in: query |
| 110 | + schema: |
| 111 | + type: integer |
| 112 | + examples: |
| 113 | + # — used in GET /pets response |
| 114 | + ExampleUsed: |
| 115 | + summary: A single pet |
| 116 | + value: |
| 117 | + id: 1 |
| 118 | + # — never referenced → direct unused |
| 119 | + ExampleUnused: |
| 120 | + summary: Not used |
| 121 | + value: |
| 122 | + hello: world |
| 123 | + requestBodies: |
| 124 | + # — used by POST /pets |
| 125 | + RequestBodyUsed: |
| 126 | + description: New pet to add |
| 127 | + content: |
| 128 | + application/json: |
| 129 | + schema: |
| 130 | + $ref: '#/components/schemas/SchemaUsed' |
| 131 | + # — never referenced → direct unused |
| 132 | + RequestBodyUnused: |
| 133 | + description: Not used |
| 134 | + content: |
| 135 | + application/json: |
| 136 | + schema: |
| 137 | + type: object |
| 138 | + headers: |
| 139 | + # — used in GET /pets response |
| 140 | + HeaderUsed: |
| 141 | + description: Rate limit info |
| 142 | + schema: |
| 143 | + type: integer |
| 144 | + # — never referenced → direct unused |
| 145 | + HeaderUnused: |
| 146 | + description: Not used |
| 147 | + schema: |
| 148 | + type: string |
0 commit comments