fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #442 from hey-api/feat/add-errors-to-operation-mappings

authored by

Jordan Shatford and committed by
GitHub
840d9df6 fbf5de79

+466 -34
+5
.changeset/short-cows-think.md
··· 1 + --- 2 + "@hey-api/openapi-ts": minor 3 + --- 4 + 5 + feat: add operation error type mappings
+1 -6
packages/openapi-ts/src/openApi/common/interfaces/client.ts
··· 10 10 value: string | number; 11 11 } 12 12 13 - export interface OperationError { 14 - code: number; 15 - description: string; 16 - } 17 - 18 13 export interface OperationParameter extends Model { 19 14 in: 'path' | 'query' | 'header' | 'formData' | 'body' | 'cookie'; 20 15 prop: string; ··· 39 34 export interface Operation extends OperationParameters { 40 35 deprecated: boolean; 41 36 description: string | null; 42 - errors: OperationError[]; 37 + errors: OperationResponse[]; 43 38 method: 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT'; 44 39 /** 45 40 * Method name. Methods contain the request logic.
+6 -11
packages/openapi-ts/src/openApi/common/parser/operation.ts
··· 1 1 import camelCase from 'camelcase'; 2 2 3 3 import { getConfig } from '../../../utils/config'; 4 - import type { OperationError, OperationResponse } from '../interfaces/client'; 4 + import type { OperationResponse } from '../interfaces/client'; 5 5 import { reservedWords } from './reservedWords'; 6 6 import { 7 7 sanitizeNamespaceIdentifier, ··· 74 74 75 75 export const getOperationErrors = ( 76 76 operationResponses: OperationResponse[], 77 - ): OperationError[] => 78 - operationResponses 79 - .filter( 80 - (operationResponse) => 81 - operationResponse.code >= 300 && operationResponse.description, 82 - ) 83 - .map((response) => ({ 84 - code: response.code, 85 - description: response.description!, 86 - })); 77 + ): OperationResponse[] => 78 + operationResponses.filter( 79 + (operationResponse) => 80 + operationResponse.code >= 300 && operationResponse.description, 81 + );
+18 -1
packages/openapi-ts/src/utils/write/models.ts
··· 144 144 service.operations.forEach((operation) => { 145 145 const hasReq = operation.parameters.length; 146 146 const hasRes = operation.results.length; 147 + const hasErr = operation.errors.length; 147 148 148 - if (hasReq || hasRes) { 149 + if (hasReq || hasRes || hasErr) { 149 150 let pathMap = pathsMap.get(operation.path); 150 151 if (!pathMap) { 151 152 pathsMap.set(operation.path, new Map()); ··· 175 176 176 177 operation.results.forEach((result) => { 177 178 resMap.set(result.code, result); 179 + }); 180 + } 181 + 182 + if (hasErr) { 183 + let resMap = methodMap.get('res'); 184 + if (!resMap) { 185 + methodMap.set('res', new Map()); 186 + resMap = methodMap.get('res')!; 187 + } 188 + 189 + if (Array.isArray(resMap)) { 190 + return; 191 + } 192 + 193 + operation.errors.forEach((error) => { 194 + resMap.set(error.code, error); 178 195 }); 179 196 } 180 197 }
+2 -4
packages/openapi-ts/src/utils/write/services.ts
··· 46 46 const toOperationReturnType = (operation: Operation) => { 47 47 const config = getConfig(); 48 48 const baseTypePath = `${serviceExportedNamespace()}['${operation.path}']['${operation.method.toLocaleLowerCase()}']['res']`; 49 - const results = operation.results.filter( 50 - (result) => result.code >= 200 && result.code < 300, 51 - ); 49 + const results = operation.results; 52 50 // TODO: we should return nothing when results don't exist 53 51 // can't remove this logic without removing request/name config 54 52 // as it complicates things ··· 157 155 if (operation.errors.length) { 158 156 const errors: Record<number, string> = {}; 159 157 operation.errors.forEach((err) => { 160 - errors[err.code] = escapeDescription(err.description); 158 + errors[err.code] = escapeDescription(err.description ?? ''); 161 159 }); 162 160 obj.errors = errors; 163 161 }
+11
packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.gen.ts.snap
··· 266 266 }, 267 267 } as const; 268 268 269 + export const $ModelWithStringError = { 270 + description: 'This is a model with one string property', 271 + type: 'object', 272 + properties: { 273 + prop: { 274 + description: 'This is a simple string property', 275 + type: 'string', 276 + }, 277 + }, 278 + } as const; 279 + 269 280 export const $ModelWithNullableString = { 270 281 description: 'This is a model with one string property', 271 282 type: 'object',
+66
packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap
··· 225 225 /** 226 226 * This is a model with one string property 227 227 */ 228 + export type ModelWithStringError = { 229 + /** 230 + * This is a simple string property 231 + */ 232 + prop?: string; 233 + }; 234 + 235 + /** 236 + * This is a model with one string property 237 + */ 228 238 export type ModelWithNullableString = { 229 239 /** 230 240 * This is a simple string property ··· 628 638 * Message for default response 629 639 */ 630 640 200: ModelWithString; 641 + /** 642 + * Message for 500 error 643 + */ 644 + 500: ModelWithStringError; 645 + /** 646 + * Message for 501 error 647 + */ 648 + 501: ModelWithStringError; 649 + /** 650 + * Message for 502 error 651 + */ 652 + 502: ModelWithStringError; 631 653 }; 632 654 }; 633 655 put: { ··· 644 666 * Message for 202 response 645 667 */ 646 668 202: ModelThatExtendsExtends; 669 + /** 670 + * Message for 500 error 671 + */ 672 + 500: ModelWithStringError; 673 + /** 674 + * Message for 501 error 675 + */ 676 + 501: ModelWithStringError; 677 + /** 678 + * Message for 502 error 679 + */ 680 + 502: ModelWithStringError; 647 681 }; 648 682 }; 649 683 }; ··· 774 808 * Successful response 775 809 */ 776 810 200: Array<ModelWithString>; 811 + /** 812 + * 400 server error 813 + */ 814 + 400: unknown; 815 + /** 816 + * 500 server error 817 + */ 818 + 500: unknown; 777 819 }; 778 820 }; 779 821 }; ··· 784 826 * Successful response 785 827 */ 786 828 200: string; 829 + /** 830 + * 400 server error 831 + */ 832 + 400: unknown; 833 + /** 834 + * 500 server error 835 + */ 836 + 500: unknown; 787 837 }; 788 838 }; 789 839 }; ··· 800 850 * Custom message: Successful response 801 851 */ 802 852 200: unknown; 853 + /** 854 + * Custom message: Internal Server Error 855 + */ 856 + 500: unknown; 857 + /** 858 + * Custom message: Not Implemented 859 + */ 860 + 501: unknown; 861 + /** 862 + * Custom message: Bad Gateway 863 + */ 864 + 502: unknown; 865 + /** 866 + * Custom message: Service Unavailable 867 + */ 868 + 503: unknown; 803 869 }; 804 870 }; 805 871 };
+11
packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.gen.ts.snap
··· 364 364 }, 365 365 } as const; 366 366 367 + export const $ModelWithStringError = { 368 + description: 'This is a model with one string property', 369 + type: 'object', 370 + properties: { 371 + prop: { 372 + description: 'This is a simple string property', 373 + type: 'string', 374 + }, 375 + }, 376 + } as const; 377 + 367 378 export const $Model_From_Zendesk = { 368 379 description: `\`Comment\` or \`VoiceComment\`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets)`, 369 380 type: 'string',
+66
packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap
··· 270 270 }; 271 271 272 272 /** 273 + * This is a model with one string property 274 + */ 275 + export type ModelWithStringError = { 276 + /** 277 + * This is a simple string property 278 + */ 279 + prop?: string; 280 + }; 281 + 282 + /** 273 283 * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 274 284 */ 275 285 export type Model_From_Zendesk = string; ··· 1214 1224 * Message for default response 1215 1225 */ 1216 1226 200: ModelWithString; 1227 + /** 1228 + * Message for 500 error 1229 + */ 1230 + 500: ModelWithStringError; 1231 + /** 1232 + * Message for 501 error 1233 + */ 1234 + 501: ModelWithStringError; 1235 + /** 1236 + * Message for 502 error 1237 + */ 1238 + 502: ModelWithStringError; 1217 1239 }; 1218 1240 }; 1219 1241 put: { ··· 1230 1252 * Message for 202 response 1231 1253 */ 1232 1254 202: ModelThatExtendsExtends; 1255 + /** 1256 + * Message for 500 error 1257 + */ 1258 + 500: ModelWithStringError; 1259 + /** 1260 + * Message for 501 error 1261 + */ 1262 + 501: ModelWithStringError; 1263 + /** 1264 + * Message for 502 error 1265 + */ 1266 + 502: ModelWithStringError; 1233 1267 }; 1234 1268 }; 1235 1269 }; ··· 1390 1424 * Successful response 1391 1425 */ 1392 1426 200: Array<ModelWithString>; 1427 + /** 1428 + * 400 `server` error 1429 + */ 1430 + 400: unknown; 1431 + /** 1432 + * 500 server error 1433 + */ 1434 + 500: unknown; 1393 1435 }; 1394 1436 }; 1395 1437 }; ··· 1454 1496 * Successful response 1455 1497 */ 1456 1498 200: string; 1499 + /** 1500 + * 400 server error 1501 + */ 1502 + 400: unknown; 1503 + /** 1504 + * 500 server error 1505 + */ 1506 + 500: unknown; 1457 1507 }; 1458 1508 }; 1459 1509 }; ··· 1470 1520 * Custom message: Successful response 1471 1521 */ 1472 1522 200: unknown; 1523 + /** 1524 + * Custom message: Internal Server Error 1525 + */ 1526 + 500: unknown; 1527 + /** 1528 + * Custom message: Not Implemented 1529 + */ 1530 + 501: unknown; 1531 + /** 1532 + * Custom message: Bad Gateway 1533 + */ 1534 + 502: unknown; 1535 + /** 1536 + * Custom message: Service Unavailable 1537 + */ 1538 + 503: unknown; 1473 1539 }; 1474 1540 }; 1475 1541 };
+66
packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap
··· 270 270 }; 271 271 272 272 /** 273 + * This is a model with one string property 274 + */ 275 + export type ModelWithStringError = { 276 + /** 277 + * This is a simple string property 278 + */ 279 + prop?: string; 280 + }; 281 + 282 + /** 273 283 * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 274 284 */ 275 285 export type Model_From_Zendesk = string; ··· 1214 1224 * Message for default response 1215 1225 */ 1216 1226 200: ModelWithString; 1227 + /** 1228 + * Message for 500 error 1229 + */ 1230 + 500: ModelWithStringError; 1231 + /** 1232 + * Message for 501 error 1233 + */ 1234 + 501: ModelWithStringError; 1235 + /** 1236 + * Message for 502 error 1237 + */ 1238 + 502: ModelWithStringError; 1217 1239 }; 1218 1240 }; 1219 1241 put: { ··· 1230 1252 * Message for 202 response 1231 1253 */ 1232 1254 202: ModelThatExtendsExtends; 1255 + /** 1256 + * Message for 500 error 1257 + */ 1258 + 500: ModelWithStringError; 1259 + /** 1260 + * Message for 501 error 1261 + */ 1262 + 501: ModelWithStringError; 1263 + /** 1264 + * Message for 502 error 1265 + */ 1266 + 502: ModelWithStringError; 1233 1267 }; 1234 1268 }; 1235 1269 }; ··· 1390 1424 * Successful response 1391 1425 */ 1392 1426 200: Array<ModelWithString>; 1427 + /** 1428 + * 400 `server` error 1429 + */ 1430 + 400: unknown; 1431 + /** 1432 + * 500 server error 1433 + */ 1434 + 500: unknown; 1393 1435 }; 1394 1436 }; 1395 1437 }; ··· 1454 1496 * Successful response 1455 1497 */ 1456 1498 200: string; 1499 + /** 1500 + * 400 server error 1501 + */ 1502 + 400: unknown; 1503 + /** 1504 + * 500 server error 1505 + */ 1506 + 500: unknown; 1457 1507 }; 1458 1508 }; 1459 1509 }; ··· 1470 1520 * Custom message: Successful response 1471 1521 */ 1472 1522 200: unknown; 1523 + /** 1524 + * Custom message: Internal Server Error 1525 + */ 1526 + 500: unknown; 1527 + /** 1528 + * Custom message: Not Implemented 1529 + */ 1530 + 501: unknown; 1531 + /** 1532 + * Custom message: Bad Gateway 1533 + */ 1534 + 502: unknown; 1535 + /** 1536 + * Custom message: Service Unavailable 1537 + */ 1538 + 503: unknown; 1473 1539 }; 1474 1540 }; 1475 1541 };
+66
packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap
··· 270 270 }; 271 271 272 272 /** 273 + * This is a model with one string property 274 + */ 275 + export type ModelWithStringError = { 276 + /** 277 + * This is a simple string property 278 + */ 279 + prop?: string; 280 + }; 281 + 282 + /** 273 283 * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 274 284 */ 275 285 export type Model_From_Zendesk = string; ··· 1214 1224 * Message for default response 1215 1225 */ 1216 1226 200: ModelWithString; 1227 + /** 1228 + * Message for 500 error 1229 + */ 1230 + 500: ModelWithStringError; 1231 + /** 1232 + * Message for 501 error 1233 + */ 1234 + 501: ModelWithStringError; 1235 + /** 1236 + * Message for 502 error 1237 + */ 1238 + 502: ModelWithStringError; 1217 1239 }; 1218 1240 }; 1219 1241 put: { ··· 1230 1252 * Message for 202 response 1231 1253 */ 1232 1254 202: ModelThatExtendsExtends; 1255 + /** 1256 + * Message for 500 error 1257 + */ 1258 + 500: ModelWithStringError; 1259 + /** 1260 + * Message for 501 error 1261 + */ 1262 + 501: ModelWithStringError; 1263 + /** 1264 + * Message for 502 error 1265 + */ 1266 + 502: ModelWithStringError; 1233 1267 }; 1234 1268 }; 1235 1269 }; ··· 1390 1424 * Successful response 1391 1425 */ 1392 1426 200: Array<ModelWithString>; 1427 + /** 1428 + * 400 `server` error 1429 + */ 1430 + 400: unknown; 1431 + /** 1432 + * 500 server error 1433 + */ 1434 + 500: unknown; 1393 1435 }; 1394 1436 }; 1395 1437 }; ··· 1454 1496 * Successful response 1455 1497 */ 1456 1498 200: string; 1499 + /** 1500 + * 400 server error 1501 + */ 1502 + 400: unknown; 1503 + /** 1504 + * 500 server error 1505 + */ 1506 + 500: unknown; 1457 1507 }; 1458 1508 }; 1459 1509 }; ··· 1470 1520 * Custom message: Successful response 1471 1521 */ 1472 1522 200: unknown; 1523 + /** 1524 + * Custom message: Internal Server Error 1525 + */ 1526 + 500: unknown; 1527 + /** 1528 + * Custom message: Not Implemented 1529 + */ 1530 + 501: unknown; 1531 + /** 1532 + * Custom message: Bad Gateway 1533 + */ 1534 + 502: unknown; 1535 + /** 1536 + * Custom message: Service Unavailable 1537 + */ 1538 + 503: unknown; 1473 1539 }; 1474 1540 }; 1475 1541 };
+66
packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap
··· 270 270 }; 271 271 272 272 /** 273 + * This is a model with one string property 274 + */ 275 + export type ModelWithStringError = { 276 + /** 277 + * This is a simple string property 278 + */ 279 + prop?: string; 280 + }; 281 + 282 + /** 273 283 * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 274 284 */ 275 285 export type Model_From_Zendesk = string; ··· 1214 1224 * Message for default response 1215 1225 */ 1216 1226 200: ModelWithString; 1227 + /** 1228 + * Message for 500 error 1229 + */ 1230 + 500: ModelWithStringError; 1231 + /** 1232 + * Message for 501 error 1233 + */ 1234 + 501: ModelWithStringError; 1235 + /** 1236 + * Message for 502 error 1237 + */ 1238 + 502: ModelWithStringError; 1217 1239 }; 1218 1240 }; 1219 1241 put: { ··· 1230 1252 * Message for 202 response 1231 1253 */ 1232 1254 202: ModelThatExtendsExtends; 1255 + /** 1256 + * Message for 500 error 1257 + */ 1258 + 500: ModelWithStringError; 1259 + /** 1260 + * Message for 501 error 1261 + */ 1262 + 501: ModelWithStringError; 1263 + /** 1264 + * Message for 502 error 1265 + */ 1266 + 502: ModelWithStringError; 1233 1267 }; 1234 1268 }; 1235 1269 }; ··· 1390 1424 * Successful response 1391 1425 */ 1392 1426 200: Array<ModelWithString>; 1427 + /** 1428 + * 400 `server` error 1429 + */ 1430 + 400: unknown; 1431 + /** 1432 + * 500 server error 1433 + */ 1434 + 500: unknown; 1393 1435 }; 1394 1436 }; 1395 1437 }; ··· 1454 1496 * Successful response 1455 1497 */ 1456 1498 200: string; 1499 + /** 1500 + * 400 server error 1501 + */ 1502 + 400: unknown; 1503 + /** 1504 + * 500 server error 1505 + */ 1506 + 500: unknown; 1457 1507 }; 1458 1508 }; 1459 1509 }; ··· 1470 1520 * Custom message: Successful response 1471 1521 */ 1472 1522 200: unknown; 1523 + /** 1524 + * Custom message: Internal Server Error 1525 + */ 1526 + 500: unknown; 1527 + /** 1528 + * Custom message: Not Implemented 1529 + */ 1530 + 501: unknown; 1531 + /** 1532 + * Custom message: Bad Gateway 1533 + */ 1534 + 502: unknown; 1535 + /** 1536 + * Custom message: Service Unavailable 1537 + */ 1538 + 503: unknown; 1473 1539 }; 1474 1540 }; 1475 1541 };
+10
packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap
··· 10 10 prop?: string; 11 11 }; 12 12 13 + /** 14 + * This is a model with one string property 15 + */ 16 + export type ModelWithStringError = { 17 + /** 18 + * This is a simple string property 19 + */ 20 + prop?: string; 21 + }; 22 + 13 23 export type $OpenApiTs = { 14 24 '/api/v{api-version}/defaults': { 15 25 get: {
+10
packages/openapi-ts/test/__snapshots__/test/generated/v3_models/types.gen.ts.snap
··· 270 270 }; 271 271 272 272 /** 273 + * This is a model with one string property 274 + */ 275 + export type ModelWithStringError = { 276 + /** 277 + * This is a simple string property 278 + */ 279 + prop?: string; 280 + }; 281 + 282 + /** 273 283 * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) 274 284 */ 275 285 export type Model_From_Zendesk = string;
+10
packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap
··· 10 10 prop?: string; 11 11 }; 12 12 13 + /** 14 + * This is a model with one string property 15 + */ 16 + export type ModelWithStringError = { 17 + /** 18 + * This is a simple string property 19 + */ 20 + prop?: string; 21 + }; 22 + 13 23 export type $OpenApiTs = { 14 24 '/api/v{api-version}/defaults': { 15 25 get: {
+9
packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/schemas.gen.ts.snap
··· 308 308 }, 309 309 } as const; 310 310 311 + export const $ModelWithStringError = { 312 + type: 'object', 313 + properties: { 314 + prop: { 315 + type: 'string', 316 + }, 317 + }, 318 + } as const; 319 + 311 320 export const $Model_From_Zendesk = { 312 321 type: 'string', 313 322 } as const;
+11
packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/schemas.gen.ts.snap
··· 364 364 }, 365 365 } as const; 366 366 367 + export const $ModelWithStringError = { 368 + description: 'This is a model with one string property', 369 + type: 'object', 370 + properties: { 371 + prop: { 372 + description: 'This is a simple string property', 373 + type: 'string', 374 + }, 375 + }, 376 + } as const; 377 + 367 378 export const $Model_From_Zendesk = { 368 379 description: `\`Comment\` or \`VoiceComment\`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets)`, 369 380 type: 'string',
+16 -6
packages/openapi-ts/test/spec/v2.json
··· 487 487 "500": { 488 488 "description": "Message for 500 error", 489 489 "schema": { 490 - "$ref": "#/definitions/ModelWithString" 490 + "$ref": "#/definitions/ModelWithStringError" 491 491 } 492 492 }, 493 493 "501": { 494 494 "description": "Message for 501 error", 495 495 "schema": { 496 - "$ref": "#/definitions/ModelWithString" 496 + "$ref": "#/definitions/ModelWithStringError" 497 497 } 498 498 }, 499 499 "502": { 500 500 "description": "Message for 502 error", 501 501 "schema": { 502 - "$ref": "#/definitions/ModelWithString" 502 + "$ref": "#/definitions/ModelWithStringError" 503 503 } 504 504 } 505 505 } ··· 552 552 "500": { 553 553 "description": "Message for 500 error", 554 554 "schema": { 555 - "$ref": "#/definitions/ModelWithString" 555 + "$ref": "#/definitions/ModelWithStringError" 556 556 } 557 557 }, 558 558 "501": { 559 559 "description": "Message for 501 error", 560 560 "schema": { 561 - "$ref": "#/definitions/ModelWithString" 561 + "$ref": "#/definitions/ModelWithStringError" 562 562 } 563 563 }, 564 564 "502": { 565 565 "description": "Message for 502 error", 566 566 "schema": { 567 - "$ref": "#/definitions/ModelWithString" 567 + "$ref": "#/definitions/ModelWithStringError" 568 568 } 569 569 } 570 570 } ··· 1094 1094 } 1095 1095 }, 1096 1096 "ModelWithString": { 1097 + "description": "This is a model with one string property", 1098 + "type": "object", 1099 + "properties": { 1100 + "prop": { 1101 + "description": "This is a simple string property", 1102 + "type": "string" 1103 + } 1104 + } 1105 + }, 1106 + "ModelWithStringError": { 1097 1107 "description": "This is a model with one string property", 1098 1108 "type": "object", 1099 1109 "properties": {
+16 -6
packages/openapi-ts/test/spec/v3.json
··· 823 823 "content": { 824 824 "application/json": { 825 825 "schema": { 826 - "$ref": "#/components/schemas/ModelWithString" 826 + "$ref": "#/components/schemas/ModelWithStringError" 827 827 } 828 828 } 829 829 } ··· 833 833 "content": { 834 834 "application/json": { 835 835 "schema": { 836 - "$ref": "#/components/schemas/ModelWithString" 836 + "$ref": "#/components/schemas/ModelWithStringError" 837 837 } 838 838 } 839 839 } ··· 843 843 "content": { 844 844 "application/json": { 845 845 "schema": { 846 - "$ref": "#/components/schemas/ModelWithString" 846 + "$ref": "#/components/schemas/ModelWithStringError" 847 847 } 848 848 } 849 849 } ··· 916 916 "content": { 917 917 "application/json": { 918 918 "schema": { 919 - "$ref": "#/components/schemas/ModelWithString" 919 + "$ref": "#/components/schemas/ModelWithStringError" 920 920 } 921 921 } 922 922 } ··· 926 926 "content": { 927 927 "application/json": { 928 928 "schema": { 929 - "$ref": "#/components/schemas/ModelWithString" 929 + "$ref": "#/components/schemas/ModelWithStringError" 930 930 } 931 931 } 932 932 } ··· 936 936 "content": { 937 937 "application/json": { 938 938 "schema": { 939 - "$ref": "#/components/schemas/ModelWithString" 939 + "$ref": "#/components/schemas/ModelWithStringError" 940 940 } 941 941 } 942 942 } ··· 1937 1937 } 1938 1938 }, 1939 1939 "ModelWithString": { 1940 + "description": "This is a model with one string property", 1941 + "type": "object", 1942 + "properties": { 1943 + "prop": { 1944 + "description": "This is a simple string property", 1945 + "type": "string" 1946 + } 1947 + } 1948 + }, 1949 + "ModelWithStringError": { 1940 1950 "description": "This is a model with one string property", 1941 1951 "type": "object", 1942 1952 "properties": {