#### Bug Report Checklist - [x] Have you provided a full/minimal spec to reproduce the issue? - [x] Have you validated the input using an OpenAPI validator ([example](https://apidevtools.org/swagger-parser/online/))? - [x] Have you [tested with the latest master](https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator) to confirm the issue still exists? - [x] Have you searched for related issues/PRs? - [ ] What's the actual output vs expected output? - [ ] [Optional] Sponsorship to speed up the bug fix or feature request ([example](https://github.com/OpenAPITools/openapi-generator/issues/6178)) <!-- Please follow the issue template below for bug reports. Also please indicate in the issue title which language/library is concerned. Eg: [BUG][JAVA] Bug generating foo with bar --> ##### Description The `RequiredError` in the typescript generated code looks like this: ``` export class RequiredError extends Error { name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); } } ``` Cf. https://github.com/OpenAPITools/openapi-generator/blob/master/samples/openapi3/client/petstore/typescript/builds/default/apis/baseapi.ts#L32-L37 It is used like this though: ``` throw new RequiredError('Required parameter pet was null or undefined when calling addPet.'); ``` Cf. https://github.com/OpenAPITools/openapi-generator/blob/master/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts#L29 I.e. the `field` parameter is missing in the construction. In practice this means, the error message is empty and the message string is set on the field attribute of the error. ##### openapi-generator version 5.1.1 locally and also on current main. ##### Suggest a fix <!-- if you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit), or simply make a suggestion --> `RequiredError` should get two parameters `method` and `field`. The error message can then be generated at a single point. As a bonus the API name can also be included as a prefix in the method parameter.