diff --git a/.changeset/short-cows-think.md b/.changeset/short-cows-think.md new file mode 100644 index 000000000..f0853d161 --- /dev/null +++ b/.changeset/short-cows-think.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": minor +--- + +feat: add operation error type mappings diff --git a/packages/openapi-ts/src/openApi/common/interfaces/client.ts b/packages/openapi-ts/src/openApi/common/interfaces/client.ts index 962facdc7..49e1a849a 100644 --- a/packages/openapi-ts/src/openApi/common/interfaces/client.ts +++ b/packages/openapi-ts/src/openApi/common/interfaces/client.ts @@ -10,11 +10,6 @@ export interface Enum { value: string | number; } -export interface OperationError { - code: number; - description: string; -} - export interface OperationParameter extends Model { in: 'path' | 'query' | 'header' | 'formData' | 'body' | 'cookie'; prop: string; @@ -39,7 +34,7 @@ export interface OperationResponse extends Model { export interface Operation extends OperationParameters { deprecated: boolean; description: string | null; - errors: OperationError[]; + errors: OperationResponse[]; method: 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT'; /** * Method name. Methods contain the request logic. diff --git a/packages/openapi-ts/src/openApi/common/parser/operation.ts b/packages/openapi-ts/src/openApi/common/parser/operation.ts index 0f89d52dc..ff6c2309e 100644 --- a/packages/openapi-ts/src/openApi/common/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/common/parser/operation.ts @@ -1,7 +1,7 @@ import camelCase from 'camelcase'; import { getConfig } from '../../../utils/config'; -import type { OperationError, OperationResponse } from '../interfaces/client'; +import type { OperationResponse } from '../interfaces/client'; import { reservedWords } from './reservedWords'; import { sanitizeNamespaceIdentifier, @@ -74,13 +74,8 @@ export const getOperationResponseCode = ( export const getOperationErrors = ( operationResponses: OperationResponse[], -): OperationError[] => - operationResponses - .filter( - (operationResponse) => - operationResponse.code >= 300 && operationResponse.description, - ) - .map((response) => ({ - code: response.code, - description: response.description!, - })); +): OperationResponse[] => + operationResponses.filter( + (operationResponse) => + operationResponse.code >= 300 && operationResponse.description, + ); diff --git a/packages/openapi-ts/src/utils/write/models.ts b/packages/openapi-ts/src/utils/write/models.ts index d64f303e8..b6b3df6b2 100644 --- a/packages/openapi-ts/src/utils/write/models.ts +++ b/packages/openapi-ts/src/utils/write/models.ts @@ -144,8 +144,9 @@ const processServiceTypes = (services: Service[], onNode: OnNode) => { service.operations.forEach((operation) => { const hasReq = operation.parameters.length; const hasRes = operation.results.length; + const hasErr = operation.errors.length; - if (hasReq || hasRes) { + if (hasReq || hasRes || hasErr) { let pathMap = pathsMap.get(operation.path); if (!pathMap) { pathsMap.set(operation.path, new Map()); @@ -177,6 +178,22 @@ const processServiceTypes = (services: Service[], onNode: OnNode) => { resMap.set(result.code, result); }); } + + if (hasErr) { + let resMap = methodMap.get('res'); + if (!resMap) { + methodMap.set('res', new Map()); + resMap = methodMap.get('res')!; + } + + if (Array.isArray(resMap)) { + return; + } + + operation.errors.forEach((error) => { + resMap.set(error.code, error); + }); + } } }); }); diff --git a/packages/openapi-ts/src/utils/write/services.ts b/packages/openapi-ts/src/utils/write/services.ts index cb692f1ff..bd9bab8b4 100644 --- a/packages/openapi-ts/src/utils/write/services.ts +++ b/packages/openapi-ts/src/utils/write/services.ts @@ -46,9 +46,7 @@ const toOperationParamType = (operation: Operation): FunctionParameter[] => { const toOperationReturnType = (operation: Operation) => { const config = getConfig(); const baseTypePath = `${serviceExportedNamespace()}['${operation.path}']['${operation.method.toLocaleLowerCase()}']['res']`; - const results = operation.results.filter( - (result) => result.code >= 200 && result.code < 300, - ); + const results = operation.results; // TODO: we should return nothing when results don't exist // can't remove this logic without removing request/name config // as it complicates things @@ -157,7 +155,7 @@ const toRequestOptions = (operation: Operation) => { if (operation.errors.length) { const errors: Record = {}; operation.errors.forEach((err) => { - errors[err.code] = escapeDescription(err.description); + errors[err.code] = escapeDescription(err.description ?? ''); }); obj.errors = errors; } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.gen.ts.snap index 345aeb3ef..0d2240112 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.gen.ts.snap @@ -266,6 +266,17 @@ export const $ModelWithString = { }, } as const; +export const $ModelWithStringError = { + description: 'This is a model with one string property', + type: 'object', + properties: { + prop: { + description: 'This is a simple string property', + type: 'string', + }, + }, +} as const; + export const $ModelWithNullableString = { description: 'This is a model with one string property', type: 'object', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap index a7ed2c02e..ab06b3071 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap @@ -222,6 +222,16 @@ export type ModelWithString = { prop?: string; }; +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + /** * This is a model with one string property */ @@ -628,6 +638,18 @@ export type $OpenApiTs = { * Message for default response */ 200: ModelWithString; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; put: { @@ -644,6 +666,18 @@ export type $OpenApiTs = { * Message for 202 response */ 202: ModelThatExtendsExtends; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; }; @@ -774,6 +808,14 @@ export type $OpenApiTs = { * Successful response */ 200: Array; + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -784,6 +826,14 @@ export type $OpenApiTs = { * Successful response */ 200: string; + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -800,6 +850,22 @@ export type $OpenApiTs = { * Custom message: Successful response */ 200: unknown; + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; }; }; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.gen.ts.snap index c29b4745a..6ada30768 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.gen.ts.snap @@ -364,6 +364,17 @@ export const $ModelWithString = { }, } as const; +export const $ModelWithStringError = { + description: 'This is a model with one string property', + type: 'object', + properties: { + prop: { + description: 'This is a simple string property', + type: 'string', + }, + }, +} as const; + export const $Model_From_Zendesk = { 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)`, type: 'string', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap index 3b021bc83..f6f2afd4d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap @@ -269,6 +269,16 @@ export type ModelWithString = { prop?: string; }; +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + /** * `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) */ @@ -1214,6 +1224,18 @@ export type $OpenApiTs = { * Message for default response */ 200: ModelWithString; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; put: { @@ -1230,6 +1252,18 @@ export type $OpenApiTs = { * Message for 202 response */ 202: ModelThatExtendsExtends; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; }; @@ -1390,6 +1424,14 @@ export type $OpenApiTs = { * Successful response */ 200: Array; + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -1454,6 +1496,14 @@ export type $OpenApiTs = { * Successful response */ 200: string; + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -1470,6 +1520,22 @@ export type $OpenApiTs = { * Custom message: Successful response */ 200: unknown; + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; }; }; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap index 3b021bc83..f6f2afd4d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap @@ -269,6 +269,16 @@ export type ModelWithString = { prop?: string; }; +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + /** * `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) */ @@ -1214,6 +1224,18 @@ export type $OpenApiTs = { * Message for default response */ 200: ModelWithString; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; put: { @@ -1230,6 +1252,18 @@ export type $OpenApiTs = { * Message for 202 response */ 202: ModelThatExtendsExtends; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; }; @@ -1390,6 +1424,14 @@ export type $OpenApiTs = { * Successful response */ 200: Array; + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -1454,6 +1496,14 @@ export type $OpenApiTs = { * Successful response */ 200: string; + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -1470,6 +1520,22 @@ export type $OpenApiTs = { * Custom message: Successful response */ 200: unknown; + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; }; }; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap index 00f1cc247..54122b684 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap @@ -269,6 +269,16 @@ export type ModelWithString = { prop?: string; }; +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + /** * `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) */ @@ -1214,6 +1224,18 @@ export type $OpenApiTs = { * Message for default response */ 200: ModelWithString; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; put: { @@ -1230,6 +1252,18 @@ export type $OpenApiTs = { * Message for 202 response */ 202: ModelThatExtendsExtends; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; }; @@ -1390,6 +1424,14 @@ export type $OpenApiTs = { * Successful response */ 200: Array; + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -1454,6 +1496,14 @@ export type $OpenApiTs = { * Successful response */ 200: string; + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -1470,6 +1520,22 @@ export type $OpenApiTs = { * Custom message: Successful response */ 200: unknown; + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; }; }; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap index 3b021bc83..f6f2afd4d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap @@ -269,6 +269,16 @@ export type ModelWithString = { prop?: string; }; +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + /** * `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) */ @@ -1214,6 +1224,18 @@ export type $OpenApiTs = { * Message for default response */ 200: ModelWithString; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; put: { @@ -1230,6 +1252,18 @@ export type $OpenApiTs = { * Message for 202 response */ 202: ModelThatExtendsExtends; + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; }; }; }; @@ -1390,6 +1424,14 @@ export type $OpenApiTs = { * Successful response */ 200: Array; + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -1454,6 +1496,14 @@ export type $OpenApiTs = { * Successful response */ 200: string; + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; }; }; @@ -1470,6 +1520,22 @@ export type $OpenApiTs = { * Custom message: Successful response */ 200: unknown; + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; }; }; }; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap index 689a75423..d5452b2bb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap @@ -10,6 +10,16 @@ export type ModelWithString = { prop?: string; }; +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + export type $OpenApiTs = { '/api/v{api-version}/defaults': { get: { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/types.gen.ts.snap index 27aeb0e66..a7cd5a412 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/types.gen.ts.snap @@ -269,6 +269,16 @@ export type ModelWithString = { prop?: string; }; +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + /** * `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) */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap index 45e818f35..7b2ea2ed2 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap @@ -10,6 +10,16 @@ export type ModelWithString = { prop?: string; }; +/** + * This is a model with one string property + */ +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; + export type $OpenApiTs = { '/api/v{api-version}/defaults': { get: { diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/schemas.gen.ts.snap index ca47045c5..2bad92d27 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/schemas.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/schemas.gen.ts.snap @@ -308,6 +308,15 @@ export const $ModelWithString = { }, } as const; +export const $ModelWithStringError = { + type: 'object', + properties: { + prop: { + type: 'string', + }, + }, +} as const; + export const $Model_From_Zendesk = { type: 'string', } as const; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/schemas.gen.ts.snap index c29b4745a..6ada30768 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/schemas.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/schemas.gen.ts.snap @@ -364,6 +364,17 @@ export const $ModelWithString = { }, } as const; +export const $ModelWithStringError = { + description: 'This is a model with one string property', + type: 'object', + properties: { + prop: { + description: 'This is a simple string property', + type: 'string', + }, + }, +} as const; + export const $Model_From_Zendesk = { 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)`, type: 'string', diff --git a/packages/openapi-ts/test/spec/v2.json b/packages/openapi-ts/test/spec/v2.json index 2825b34fe..4dafd5d20 100644 --- a/packages/openapi-ts/test/spec/v2.json +++ b/packages/openapi-ts/test/spec/v2.json @@ -487,19 +487,19 @@ "500": { "description": "Message for 500 error", "schema": { - "$ref": "#/definitions/ModelWithString" + "$ref": "#/definitions/ModelWithStringError" } }, "501": { "description": "Message for 501 error", "schema": { - "$ref": "#/definitions/ModelWithString" + "$ref": "#/definitions/ModelWithStringError" } }, "502": { "description": "Message for 502 error", "schema": { - "$ref": "#/definitions/ModelWithString" + "$ref": "#/definitions/ModelWithStringError" } } } @@ -552,19 +552,19 @@ "500": { "description": "Message for 500 error", "schema": { - "$ref": "#/definitions/ModelWithString" + "$ref": "#/definitions/ModelWithStringError" } }, "501": { "description": "Message for 501 error", "schema": { - "$ref": "#/definitions/ModelWithString" + "$ref": "#/definitions/ModelWithStringError" } }, "502": { "description": "Message for 502 error", "schema": { - "$ref": "#/definitions/ModelWithString" + "$ref": "#/definitions/ModelWithStringError" } } } @@ -1103,6 +1103,16 @@ } } }, + "ModelWithStringError": { + "description": "This is a model with one string property", + "type": "object", + "properties": { + "prop": { + "description": "This is a simple string property", + "type": "string" + } + } + }, "ModelWithNullableString": { "description": "This is a model with one string property", "type": "object", diff --git a/packages/openapi-ts/test/spec/v3.json b/packages/openapi-ts/test/spec/v3.json index 540d6579c..a787c14ec 100644 --- a/packages/openapi-ts/test/spec/v3.json +++ b/packages/openapi-ts/test/spec/v3.json @@ -823,7 +823,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ModelWithString" + "$ref": "#/components/schemas/ModelWithStringError" } } } @@ -833,7 +833,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ModelWithString" + "$ref": "#/components/schemas/ModelWithStringError" } } } @@ -843,7 +843,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ModelWithString" + "$ref": "#/components/schemas/ModelWithStringError" } } } @@ -916,7 +916,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ModelWithString" + "$ref": "#/components/schemas/ModelWithStringError" } } } @@ -926,7 +926,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ModelWithString" + "$ref": "#/components/schemas/ModelWithStringError" } } } @@ -936,7 +936,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ModelWithString" + "$ref": "#/components/schemas/ModelWithStringError" } } } @@ -1946,6 +1946,16 @@ } } }, + "ModelWithStringError": { + "description": "This is a model with one string property", + "type": "object", + "properties": { + "prop": { + "description": "This is a simple string property", + "type": "string" + } + } + }, "Model-From.Zendesk": { "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)", "type": "string"