;
+
+export type ModelWithAnyOfConstantSizeArrayNullable = [
+ number | null | string,
+ number | null | string,
+ number | null | string
+];
+
+export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [
+ number | Import,
+ number | Import
+];
+
+export type ModelWithAnyOfConstantSizeArrayAndIntersect = [
+ number & string,
+ number & string
+];
+
+export type ModelWithNumericEnumUnion = {
+ /**
+ * Период
+ */
+ value?: -10 | -1 | 0 | 1 | 3 | 6 | 12;
+};
+
+/**
+ * Some description with `back ticks`
+ */
+export type ModelWithBackticksInDescription = {
+ /**
+ * The template `that` should be used for parsing and importing the contents of the CSV file.
+ *
+ *
There is one placeholder currently supported:
- ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)
Example of a correct JSON template:
+ *
+ * [
+ * {
+ * "resourceType": "Asset",
+ * "identifier": {
+ * "name": "${1}",
+ * "domain": {
+ * "name": "${2}",
+ * "community": {
+ * "name": "Some Community"
+ * }
+ * }
+ * },
+ * "attributes" : {
+ * "00000000-0000-0000-0000-000000003115" : [ {
+ * "value" : "${3}"
+ * } ],
+ * "00000000-0000-0000-0000-000000000222" : [ {
+ * "value" : "${4}"
+ * } ]
+ * }
+ * }
+ * ]
+ *
+ */
+ template?: string;
+};
+
+export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & {
+ baz: number | null;
+ qux: number;
+};
+
+/**
+ * Model used to test deduplication strategy (unused)
+ */
+export type ParameterSimpleParameterUnused = string;
+
+/**
+ * Model used to test deduplication strategy
+ */
+export type PostServiceWithEmptyTagResponse = string;
+
+/**
+ * Model used to test deduplication strategy
+ */
+export type PostServiceWithEmptyTagResponse2 = string;
+
+/**
+ * Model used to test deduplication strategy
+ */
+export type DeleteFooData = string;
+
+/**
+ * Model used to test deduplication strategy
+ */
+export type DeleteFooData2 = string;
+
+/**
+ * Model with restricted keyword name
+ */
+export type Import = string;
+
+export type SchemaWithFormRestrictedKeys = {
+ description?: string;
+ 'x-enum-descriptions'?: string;
+ 'x-enum-varnames'?: string;
+ 'x-enumNames'?: string;
+ title?: string;
+ object?: {
+ description?: string;
+ 'x-enum-descriptions'?: string;
+ 'x-enum-varnames'?: string;
+ 'x-enumNames'?: string;
+ title?: string;
+ };
+ array?: Array<{
+ description?: string;
+ 'x-enum-descriptions'?: string;
+ 'x-enum-varnames'?: string;
+ 'x-enumNames'?: string;
+ title?: string;
+ }>;
+};
+
+/**
+ * This schema was giving PascalCase transformations a hard time
+ */
+export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = {
+ /**
+ * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.
+ */
+ preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions;
+};
+
+/**
+ * This schema was giving PascalCase transformations a hard time
+ */
+export type IoK8sApimachineryPkgApisMetaV1Preconditions = {
+ /**
+ * Specifies the target ResourceVersion
+ */
+ resourceVersion?: string;
+ /**
+ * Specifies the target UID.
+ */
+ uid?: string;
+};
+
+export type AdditionalPropertiesUnknownIssue = {
+ [key: string]: string | number;
+};
+
+export type AdditionalPropertiesUnknownIssue2 = {
+ [key: string]: string | number;
+};
+
+export type AdditionalPropertiesUnknownIssue3 = string & {
+ entries: {
+ [key: string]: AdditionalPropertiesUnknownIssue;
+ };
+};
+
+export type AdditionalPropertiesIntegerIssue = {
+ value: number;
+ [key: string]: number;
+};
+
+export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString;
+
+export type GenericSchemaDuplicateIssue1SystemBoolean = {
+ item?: boolean;
+ error?: string | null;
+ readonly hasError?: boolean;
+ data?: {
+ [key: string]: never;
+ };
+};
+
+export type GenericSchemaDuplicateIssue1SystemString = {
+ item?: string | null;
+ error?: string | null;
+ readonly hasError?: boolean;
+};
+
+export type ExternalSharedModel = {
+ id: string;
+ name?: string;
+};
+
+/**
+ * This is a model with one property containing a reference
+ */
+export type ModelWithReferenceWritable = {
+ prop?: ModelWithPropertiesWritable;
+};
+
+/**
+ * This is a model with one property containing an array
+ */
+export type ModelWithArrayReadOnlyAndWriteOnlyWritable = {
+ prop?: Array;
+ propWithFile?: Array;
+ propWithNumber?: Array;
+};
+
+/**
+ * This is a model with one nested property
+ */
+export type ModelWithPropertiesWritable = {
+ required: string;
+ requiredAndNullable: string | null;
+ string?: string;
+ number?: number;
+ boolean?: boolean;
+ reference?: ModelWithString;
+ 'property with space'?: string;
+ default?: string;
+ try?: string;
+};
+
+/**
+ * This is a model that contains a some patterns
+ */
+export type ModelWithPatternWritable = {
+ key: string;
+ name: string;
+ id?: string;
+ text?: string;
+ patternWithSingleQuotes?: string;
+ patternWithNewline?: string;
+ patternWithBacktick?: string;
+ patternWithUnicode?: string;
+};
+
+export type FileWritable = {
+ /**
+ * Mime
+ */
+ mime: string;
+};
+
+export type ModelWithReadOnlyAndWriteOnlyWritable = {
+ foo: string;
+ baz: string;
+};
+
+export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [
+ number | Import,
+ number | Import
+];
+
+export type AdditionalPropertiesUnknownIssueWritable = {
+ [key: string]: string | number;
+};
+
+export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString;
+
+export type GenericSchemaDuplicateIssue1SystemBooleanWritable = {
+ item?: boolean;
+ error?: string | null;
+ data?: {
+ [key: string]: never;
+ };
+};
+
+export type GenericSchemaDuplicateIssue1SystemStringWritable = {
+ item?: string | null;
+ error?: string | null;
+};
+
+/**
+ * This is a reusable parameter
+ */
+export type SimpleParameter = string;
+
+/**
+ * Parameter with illegal characters
+ */
+export type XFooBar = ModelWithString;
+
+export type SimpleRequestBody = ModelWithString;
+
+export type SimpleFormData = ModelWithString;
+
+export type ExportData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no+tag';
+};
+
+export type PatchApiVbyApiVersionNoTagData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no+tag';
+};
+
+export type PatchApiVbyApiVersionNoTagResponses = {
+ /**
+ * OK
+ */
+ default: unknown;
+};
+
+export type ImportData = {
+ body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no+tag';
+};
+
+export type ImportResponses = {
+ /**
+ * Success
+ */
+ 200: ModelFromZendesk;
+ /**
+ * Default success response
+ */
+ default: ModelWithReadOnlyAndWriteOnly;
+};
+
+export type ImportResponse = ImportResponses[keyof ImportResponses];
+
+export type FooWowData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no+tag';
+};
+
+export type FooWowResponses = {
+ /**
+ * OK
+ */
+ default: unknown;
+};
+
+export type ApiVVersionODataControllerCountData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple/$count';
+};
+
+export type ApiVVersionODataControllerCountResponses = {
+ /**
+ * Success
+ */
+ 200: ModelFromZendesk;
+};
+
+export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses];
+
+export type GetApiVbyApiVersionSimpleOperationData = {
+ body?: never;
+ path: {
+ /**
+ * foo in method
+ */
+ foo_param: string;
+ };
+ query?: never;
+ url: '/api/v{api-version}/simple:operation';
+};
+
+export type GetApiVbyApiVersionSimpleOperationErrors = {
+ /**
+ * Default error response
+ */
+ default: ModelWithBoolean;
+};
+
+export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors];
+
+export type GetApiVbyApiVersionSimpleOperationResponses = {
+ /**
+ * Response is a simple number
+ */
+ 200: number;
+};
+
+export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses];
+
+export type DeleteCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type GetCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type HeadCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type OptionsCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type PatchCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type PostCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type PutCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type DeleteFooData3 = {
+ body?: never;
+ headers: {
+ /**
+ * Parameter with illegal characters
+ */
+ 'x-Foo-Bar': ModelWithString;
+ };
+ path: {
+ /**
+ * foo in method
+ */
+ foo_param: string;
+ /**
+ * bar in method
+ */
+ BarParam: string;
+ };
+ query?: never;
+ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}';
+};
+
+export type CallWithDescriptionsData = {
+ body?: never;
+ path?: never;
+ query?: {
+ /**
+ * Testing multiline comments in string: First line
+ * Second line
+ *
+ * Fourth line
+ */
+ parameterWithBreaks?: string;
+ /**
+ * Testing backticks in string: `backticks` and ```multiple backticks``` should work
+ */
+ parameterWithBackticks?: string;
+ /**
+ * Testing slashes in string: \backwards\\\ and /forwards/// should work
+ */
+ parameterWithSlashes?: string;
+ /**
+ * Testing expression placeholders in string: ${expression} should work
+ */
+ parameterWithExpressionPlaceholders?: string;
+ /**
+ * Testing quotes in string: 'single quote''' and "double quotes""" should work
+ */
+ parameterWithQuotes?: string;
+ /**
+ * Testing reserved characters in string: * inline * and ** inline ** should work
+ */
+ parameterWithReservedCharacters?: string;
+ };
+ url: '/api/v{api-version}/descriptions';
+};
+
+export type DeprecatedCallData = {
+ body?: never;
+ headers: {
+ /**
+ * This parameter is deprecated
+ *
+ * @deprecated
+ */
+ parameter: DeprecatedModel | null;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/parameters/deprecated';
+};
+
+export type CallWithParametersData = {
+ /**
+ * This is the parameter that goes into the body
+ */
+ body: {
+ [key: string]: unknown;
+ } | null;
+ headers: {
+ /**
+ * This is the parameter that goes into the header
+ */
+ parameterHeader: string | null;
+ };
+ path: {
+ /**
+ * This is the parameter that goes into the path
+ */
+ parameterPath: string | null;
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string | null;
+ };
+ query: {
+ foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo;
+ foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo;
+ /**
+ * This is the parameter that goes into the query params
+ */
+ cursor: string | null;
+ };
+ url: '/api/v{api-version}/parameters/{parameterPath}';
+};
+
+export type CallWithWeirdParameterNamesData = {
+ /**
+ * This is the parameter that goes into the body
+ */
+ body: ModelWithString | null;
+ headers: {
+ /**
+ * This is the parameter that goes into the request header
+ */
+ 'parameter.header': string | null;
+ };
+ path: {
+ /**
+ * This is the parameter that goes into the path
+ */
+ 'parameter.path.1'?: string;
+ /**
+ * This is the parameter that goes into the path
+ */
+ 'parameter-path-2'?: string;
+ /**
+ * This is the parameter that goes into the path
+ */
+ 'PARAMETER-PATH-3'?: string;
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string | null;
+ };
+ query: {
+ /**
+ * This is the parameter with a reserved keyword
+ */
+ default?: string;
+ /**
+ * This is the parameter that goes into the request query params
+ */
+ 'parameter-query': string | null;
+ };
+ url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}';
+};
+
+export type GetCallWithOptionalParamData = {
+ /**
+ * This is a required parameter
+ */
+ body: ModelWithOneOfEnum;
+ path?: never;
+ query?: {
+ /**
+ * This is an optional parameter
+ */
+ page?: number;
+ };
+ url: '/api/v{api-version}/parameters';
+};
+
+export type PostCallWithOptionalParamData = {
+ /**
+ * This is an optional parameter
+ */
+ body?: {
+ offset?: number | null;
+ };
+ path?: never;
+ query: {
+ /**
+ * This is a required parameter
+ */
+ parameter: Pageable;
+ };
+ url: '/api/v{api-version}/parameters';
+};
+
+export type PostCallWithOptionalParamResponses = {
+ /**
+ * Response is a simple number
+ */
+ 200: number;
+ /**
+ * Success
+ */
+ 204: void;
+};
+
+export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses];
+
+export type PostApiVbyApiVersionRequestBodyData = {
+ /**
+ * A reusable request body
+ */
+ body?: SimpleRequestBody;
+ path?: never;
+ query?: {
+ /**
+ * This is a reusable parameter
+ */
+ parameter?: string;
+ };
+ url: '/api/v{api-version}/requestBody';
+};
+
+export type PostApiVbyApiVersionFormDataData = {
+ /**
+ * A reusable request body
+ */
+ body?: SimpleFormData;
+ path?: never;
+ query?: {
+ /**
+ * This is a reusable parameter
+ */
+ parameter?: string;
+ };
+ url: '/api/v{api-version}/formData';
+};
+
+export type CallWithDefaultParametersData = {
+ body?: never;
+ path?: never;
+ query?: {
+ /**
+ * This is a simple string with default value
+ */
+ parameterString?: string | null;
+ /**
+ * This is a simple number with default value
+ */
+ parameterNumber?: number | null;
+ /**
+ * This is a simple boolean with default value
+ */
+ parameterBoolean?: boolean | null;
+ /**
+ * This is a simple enum with default value
+ */
+ parameterEnum?: 'Success' | 'Warning' | 'Error';
+ /**
+ * This is a simple model with default value
+ */
+ parameterModel?: ModelWithString | null;
+ };
+ url: '/api/v{api-version}/defaults';
+};
+
+export type CallWithDefaultOptionalParametersData = {
+ body?: never;
+ path?: never;
+ query?: {
+ /**
+ * This is a simple string that is optional with default value
+ */
+ parameterString?: string;
+ /**
+ * This is a simple number that is optional with default value
+ */
+ parameterNumber?: number;
+ /**
+ * This is a simple boolean that is optional with default value
+ */
+ parameterBoolean?: boolean;
+ /**
+ * This is a simple enum that is optional with default value
+ */
+ parameterEnum?: 'Success' | 'Warning' | 'Error';
+ /**
+ * This is a simple model that is optional with default value
+ */
+ parameterModel?: ModelWithString;
+ };
+ url: '/api/v{api-version}/defaults';
+};
+
+export type CallToTestOrderOfParamsData = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * This is a optional string with default
+ */
+ parameterOptionalStringWithDefault?: string;
+ /**
+ * This is a optional string with empty default
+ */
+ parameterOptionalStringWithEmptyDefault?: string;
+ /**
+ * This is a optional string with no default
+ */
+ parameterOptionalStringWithNoDefault?: string;
+ /**
+ * This is a string with default
+ */
+ parameterStringWithDefault: string;
+ /**
+ * This is a string with empty default
+ */
+ parameterStringWithEmptyDefault: string;
+ /**
+ * This is a string with no default
+ */
+ parameterStringWithNoDefault: string;
+ /**
+ * This is a string that can be null with no default
+ */
+ parameterStringNullableWithNoDefault?: string | null;
+ /**
+ * This is a string that can be null with default
+ */
+ parameterStringNullableWithDefault?: string | null;
+ };
+ url: '/api/v{api-version}/defaults';
+};
+
+export type DuplicateNameData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/duplicate';
+};
+
+export type DuplicateName2Data = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/duplicate';
+};
+
+export type DuplicateName3Data = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/duplicate';
+};
+
+export type DuplicateName4Data = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/duplicate';
+};
+
+export type CallWithNoContentResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no-content';
+};
+
+export type CallWithNoContentResponseResponses = {
+ /**
+ * Success
+ */
+ 204: void;
+};
+
+export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses];
+
+export type CallWithResponseAndNoContentResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multiple-tags/response-and-no-content';
+};
+
+export type CallWithResponseAndNoContentResponseResponses = {
+ /**
+ * Response is a simple number
+ */
+ 200: number;
+ /**
+ * Success
+ */
+ 204: void;
+};
+
+export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses];
+
+export type DummyAData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multiple-tags/a';
+};
+
+export type DummyAResponses = {
+ 200: _400;
+};
+
+export type DummyAResponse = DummyAResponses[keyof DummyAResponses];
+
+export type DummyBData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multiple-tags/b';
+};
+
+export type DummyBResponses = {
+ /**
+ * Success
+ */
+ 204: void;
+};
+
+export type DummyBResponse = DummyBResponses[keyof DummyBResponses];
+
+export type CallWithResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/response';
+};
+
+export type CallWithResponseResponses = {
+ default: Import;
+};
+
+export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses];
+
+export type CallWithDuplicateResponsesData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/response';
+};
+
+export type CallWithDuplicateResponsesErrors = {
+ /**
+ * Message for 500 error
+ */
+ 500: ModelWithStringError;
+ /**
+ * Message for 501 error
+ */
+ 501: ModelWithStringError;
+ /**
+ * Message for 502 error
+ */
+ 502: ModelWithStringError;
+ /**
+ * Message for 4XX errors
+ */
+ '4XX': DictionaryWithArray;
+ /**
+ * Default error response
+ */
+ default: ModelWithBoolean;
+};
+
+export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors];
+
+export type CallWithDuplicateResponsesResponses = {
+ /**
+ * Message for 200 response
+ */
+ 200: ModelWithBoolean & ModelWithInteger;
+ /**
+ * Message for 201 response
+ */
+ 201: ModelWithString;
+ /**
+ * Message for 202 response
+ */
+ 202: ModelWithString;
+};
+
+export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses];
+
+export type CallWithResponsesData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/response';
+};
+
+export type CallWithResponsesErrors = {
+ /**
+ * Message for 500 error
+ */
+ 500: ModelWithStringError;
+ /**
+ * Message for 501 error
+ */
+ 501: ModelWithStringError;
+ /**
+ * Message for 502 error
+ */
+ 502: ModelWithStringError;
+ /**
+ * Message for default response
+ */
+ default: ModelWithStringError;
+};
+
+export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors];
+
+export type CallWithResponsesResponses = {
+ /**
+ * Message for 200 response
+ */
+ 200: {
+ readonly '@namespace.string'?: string;
+ readonly '@namespace.integer'?: number;
+ readonly value?: Array;
+ };
+ /**
+ * Message for 201 response
+ */
+ 201: ModelThatExtends;
+ /**
+ * Message for 202 response
+ */
+ 202: ModelThatExtendsExtends;
+};
+
+export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses];
+
+export type CollectionFormatData = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * This is an array parameter that is sent as csv format (comma-separated values)
+ */
+ parameterArrayCSV: Array | null;
+ /**
+ * This is an array parameter that is sent as ssv format (space-separated values)
+ */
+ parameterArraySSV: Array | null;
+ /**
+ * This is an array parameter that is sent as tsv format (tab-separated values)
+ */
+ parameterArrayTSV: Array | null;
+ /**
+ * This is an array parameter that is sent as pipes format (pipe-separated values)
+ */
+ parameterArrayPipes: Array | null;
+ /**
+ * This is an array parameter that is sent as multi format (multiple parameter instances)
+ */
+ parameterArrayMulti: Array | null;
+ };
+ url: '/api/v{api-version}/collectionFormat';
+};
+
+export type TypesData = {
+ body?: never;
+ path?: {
+ /**
+ * This is a number parameter
+ */
+ id?: number;
+ };
+ query: {
+ /**
+ * This is a number parameter
+ */
+ parameterNumber: number;
+ /**
+ * This is a string parameter
+ */
+ parameterString: string | null;
+ /**
+ * This is a boolean parameter
+ */
+ parameterBoolean: boolean | null;
+ /**
+ * This is an object parameter
+ */
+ parameterObject: {
+ [key: string]: unknown;
+ } | null;
+ /**
+ * This is an array parameter
+ */
+ parameterArray: Array | null;
+ /**
+ * This is a dictionary parameter
+ */
+ parameterDictionary: {
+ [key: string]: unknown;
+ } | null;
+ /**
+ * This is an enum parameter
+ */
+ parameterEnum: 'Success' | 'Warning' | 'Error';
+ };
+ url: '/api/v{api-version}/types';
+};
+
+export type TypesResponses = {
+ /**
+ * Response is a simple number
+ */
+ 200: number;
+ /**
+ * Response is a simple string
+ */
+ 201: string;
+ /**
+ * Response is a simple boolean
+ */
+ 202: boolean;
+ /**
+ * Response is a simple object
+ */
+ 203: {
+ [key: string]: unknown;
+ };
+};
+
+export type TypesResponse = TypesResponses[keyof TypesResponses];
+
+export type UploadFileData = {
+ body: Blob | File;
+ path: {
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string | null;
+ };
+ query?: never;
+ url: '/api/v{api-version}/upload';
+};
+
+export type UploadFileResponses = {
+ 200: boolean;
+};
+
+export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses];
+
+export type FileResponseData = {
+ body?: never;
+ path: {
+ id: string;
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string;
+ };
+ query?: never;
+ url: '/api/v{api-version}/file/{id}';
+};
+
+export type FileResponseResponses = {
+ /**
+ * Success
+ */
+ 200: Blob | File;
+};
+
+export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses];
+
+export type ComplexTypesData = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * Parameter containing object
+ */
+ parameterObject: {
+ first?: {
+ second?: {
+ third?: string;
+ };
+ };
+ };
+ /**
+ * Parameter containing reference
+ */
+ parameterReference: ModelWithString;
+ };
+ url: '/api/v{api-version}/complex';
+};
+
+export type ComplexTypesErrors = {
+ /**
+ * 400 `server` error
+ */
+ 400: unknown;
+ /**
+ * 500 server error
+ */
+ 500: unknown;
+};
+
+export type ComplexTypesResponses = {
+ /**
+ * Successful response
+ */
+ 200: Array;
+};
+
+export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses];
+
+export type MultipartResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multipart';
+};
+
+export type MultipartResponseResponses = {
+ /**
+ * OK
+ */
+ 200: {
+ file?: Blob | File;
+ metadata?: {
+ foo?: string;
+ bar?: string;
+ };
+ };
+};
+
+export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses];
+
+export type MultipartRequestData = {
+ body?: {
+ content?: Blob | File;
+ data?: ModelWithString | null;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multipart';
+};
+
+export type ComplexParamsData = {
+ body?: {
+ readonly key: string | null;
+ name: string | null;
+ enabled?: boolean;
+ type: 'Monkey' | 'Horse' | 'Bird';
+ listOfModels?: Array | null;
+ listOfStrings?: Array | null;
+ parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary;
+ readonly user?: {
+ readonly id?: number;
+ readonly name?: string | null;
+ };
+ };
+ path: {
+ id: number;
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string;
+ };
+ query?: never;
+ url: '/api/v{api-version}/complex/{id}';
+};
+
+export type ComplexParamsResponses = {
+ /**
+ * Success
+ */
+ 200: ModelWithString;
+};
+
+export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses];
+
+export type CallWithResultFromHeaderData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/header';
+};
+
+export type CallWithResultFromHeaderErrors = {
+ /**
+ * 400 server error
+ */
+ 400: unknown;
+ /**
+ * 500 server error
+ */
+ 500: unknown;
+};
+
+export type CallWithResultFromHeaderResponses = {
+ /**
+ * Successful response
+ */
+ 200: unknown;
+};
+
+export type TestErrorCodeData = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * Status code to return
+ */
+ status: number;
+ };
+ url: '/api/v{api-version}/error';
+};
+
+export type TestErrorCodeErrors = {
+ /**
+ * 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;
+};
+
+export type TestErrorCodeResponses = {
+ /**
+ * Custom message: Successful response
+ */
+ 200: unknown;
+};
+
+export type NonAsciiæøåÆøÅöôêÊ字符串Data = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * Dummy input param
+ */
+ nonAsciiParamæøåÆØÅöôêÊ: number;
+ };
+ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串';
+};
+
+export type NonAsciiæøåÆøÅöôêÊ字符串Responses = {
+ /**
+ * Successful response
+ */
+ 200: Array;
+};
+
+export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses];
+
+export type PutWithFormUrlEncodedData = {
+ body: ArrayWithStrings;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串';
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-locale/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-locale/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..44d096176c
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-locale/@faker-js/faker.gen.ts
@@ -0,0 +1,501 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import type { Faker } from '@faker-js/faker';
+import { faker } from '@faker-js/faker/locale/de';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakePrice = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeQuantity = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeActive = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeAnything = () => undefined;
+
+export const fakeStatusWithNull = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'active',
+ 'inactive',
+ null
+ ]);
+};
+
+export const fakeNumericEnum = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3
+ ]);
+};
+
+export const fakeEmail = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeDateTime = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString();
+};
+
+export const fakeDateOnly = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString().slice(0, 10);
+};
+
+export const fakeUniqueId = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.uuid();
+};
+
+export const fakeWebsite = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.url();
+};
+
+export const fakeIPv4Address = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv4();
+};
+
+export const fakeIPv6Address = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv6();
+};
+
+export const fakeZipCode = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.fromRegExp('^\\d{5}(-\\d{4})?$');
+};
+
+export const fakeShortName = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 2, max: 50 } });
+};
+
+export const fakeMinOnlyString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 10, max: 100 } });
+};
+
+export const fakeMaxOnlyString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 0, max: 5 } });
+};
+
+export const fakeEmailWithLength = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeBoundedInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeBoundedFloat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 9 });
+};
+
+export const fakeMinOnlyNumber = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0 });
+};
+
+export const fakeMaxOnlyInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ max: 999 });
+};
+
+export const fakeExclusiveFloat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveFloatNarrow = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 10.1, max: 10.2 });
+};
+
+export const fakeTags = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeTagList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 1, max: 10 } });
+};
+
+export const fakeMinOnlyArray = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int(), { count: { min: 3, max: 100 } });
+};
+
+export const fakeMaxOnlyArray = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 0, max: 5 } });
+};
+
+export const fakeDefaultString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 'unknown' : f.string.sample();
+};
+
+export const fakeDefaultInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int();
+};
+
+export const fakeDefaultBool = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean();
+};
+
+export const fakeDefaultOverridesConstraints = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 42 : f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeNullableString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.string.sample() : null;
+};
+
+export const fakeNullableInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.number.int() : null;
+};
+
+export const fakeObjectWithDefaultProp = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { status: resolveCondition(options?.useDefault ?? false, f) ? 'active' : f.string.sample() }
+ };
+};
+
+export const fakeUserProfile = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bio: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) }
+ };
+};
+
+export const fakeTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ label: f.string.sample()
+ };
+};
+
+export const fakePet = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ };
+};
+
+export const fakeError = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ code: f.number.int(),
+ message: f.string.sample()
+ };
+};
+
+export const fakeAddress = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ street: f.location.streetAddress(),
+ zip: fakeZipCode(options)
+ };
+};
+
+export const fakePerson = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: fakeShortName(options),
+ email: fakeEmail(options),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { address: fakeAddress(options) }
+ };
+};
+
+export const fakePersonList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePerson(options), { count: { min: 1, max: 20 } });
+};
+
+export const fakePetList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeTeam = (options?: Options) => ({
+ lead: fakePerson(options),
+ config: fakeObjectWithDefaultProp(options)
+});
+
+export const fakePetOrTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([fakePet(options), fakeTag(options)]);
+};
+
+export const fakeStringOrNumber = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([f.string.sample(), f.number.float()]);
+};
+
+export const fakeNullablePetOrTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ fakePet(options),
+ fakeTag(options),
+ null
+ ]);
+};
+
+export const fakePetWithOwner = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakePet(options), {
+ owner: f.string.sample()
+ });
+};
+
+export const fakeCircle = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ radius: f.number.float()
+ };
+};
+
+export const fakeSquare = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ side: f.number.float()
+ };
+};
+
+export const fakeShape = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeCircle(options)),
+ kind: 'Circle' as const
+ }, {
+ ...Object.assign({}, fakeSquare(options)),
+ kind: 'Square' as const
+ }]);
+};
+
+export const fakeDog = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ bark: f.datatype.boolean()
+ };
+};
+
+export const fakeCat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ purr: f.datatype.boolean()
+ };
+};
+
+export const fakeAnimal = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeDog(options)),
+ type: 'dog' as const
+ }, {
+ ...Object.assign({}, fakeCat(options)),
+ type: 'cat' as const
+ }]);
+};
+
+export const fakePersonProfile = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ firstName: f.person.firstName(),
+ last_name: f.person.lastName(),
+ email: f.internet.email(),
+ phone: f.phone.number(),
+ age: f.number.int({ max: 120, min: 1 }),
+ city: f.location.city(),
+ postalCode: f.location.zipCode(),
+ bio: f.lorem.sentence(),
+ website: f.internet.url(),
+ zipCode: f.helpers.fromRegExp('^\\d{5}$'),
+ username: f.internet.username(),
+ someRandomField: f.string.sample()
+ };
+};
+
+export const fakePersonWithConstraints = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ age: f.number.int({ max: 120, min: 18 }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { seniorAge: f.number.int({ min: 65, max: 100 }) }
+ };
+};
+
+export const fakeUser = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.person.fullName(),
+ email: f.internet.email()
+ };
+};
+
+export const fakeCompany = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.company.name()
+ };
+};
+
+export const fakeConfig = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample()
+ };
+};
+
+export const fakeNeverArray = () => [];
+
+export const fakeObjectWithOptionalNever = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int()
+ };
+};
+
+export const fakeDocument = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ _id: f.string.uuid(),
+ numericId: f.number.int()
+ };
+};
+
+export const fakeListPetsRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { limit: f.number.int({ min: 1, max: 100 }) }
+ }
+ };
+};
+
+export const fakeListPetsResponse = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeCreatePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCreatePetResponse = (options?: Options) => fakePet(options);
+
+export const fakeDeletePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeDeletePetResponse404 = (options?: Options) => fakeError(options);
+
+export const fakeGetPetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeGetPetResponse200 = (options?: Options) => fakePet(options);
+
+export const fakeGetPetResponse404 = (options?: Options) => fakeError(options);
+
+export const fakeUpdatePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ },
+ path: {
+ id: f.string.uuid()
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dryRun: f.datatype.boolean() }
+ }
+ };
+};
+
+export const fakeUpdatePetResponse = (options?: Options) => fakePet(options);
+
+export const fakeCreateJobResponse2Xx = (options?: Options) => fakePet(options);
+
+export const fakeCreateJobResponse4Xx = (options?: Options) => fakeError(options);
+
+export const fakeHealthCheckResponse = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..c5ef22034f
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/@faker-js/faker.gen.ts
@@ -0,0 +1,502 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import { faker, type Faker } from '@faker-js/faker';
+
+import type { Active, Address, Animal, Anything, BoundedFloat, BoundedInt, Cat, Circle, Company, Config, CreateJobErrors, CreateJobResponses, CreatePetData, CreatePetResponse, DateOnly, DateTime, DefaultBool, DefaultInt, DefaultOverridesConstraints, DefaultString, DeletePetData, DeletePetErrors, Document, Dog, Email, EmailWithLength, Error, ExclusiveFloat, ExclusiveFloatNarrow, ExclusiveInt, GetPetData, GetPetErrors, GetPetResponses, HealthCheckResponse, IPv4Address, IPv6Address, ListPetsData, ListPetsResponse, MaxOnlyArray, MaxOnlyInt, MaxOnlyString, MinOnlyArray, MinOnlyNumber, MinOnlyString, NeverArray, NullableInt, NullablePetOrTag, NullableString, NumericEnum, ObjectWithDefaultProp, ObjectWithOptionalNever, Person, PersonList, PersonProfile, PersonWithConstraints, Pet, PetList, PetOrTag, PetWithOwner, Price, Quantity, Shape, ShortName, Square, StatusWithNull, StringOrNumber, Tag, TagList, Tags, Team, UniqueId, UpdatePetData, UpdatePetResponse, User, UserProfile, Website, ZipCode } from '../types.gen';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakePrice = (options?: Options): Price => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeQuantity = (options?: Options): Quantity => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeActive = (options?: Options): Active => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeAnything = (): Anything => undefined;
+
+export const fakeStatusWithNull = (options?: Options): StatusWithNull => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'active',
+ 'inactive',
+ null
+ ]);
+};
+
+export const fakeNumericEnum = (options?: Options): NumericEnum => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3
+ ]);
+};
+
+export const fakeEmail = (options?: Options): Email => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeDateTime = (options?: Options): DateTime => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString();
+};
+
+export const fakeDateOnly = (options?: Options): DateOnly => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString().slice(0, 10);
+};
+
+export const fakeUniqueId = (options?: Options): UniqueId => {
+ const f = options?.faker ?? faker;
+ return f.string.uuid();
+};
+
+export const fakeWebsite = (options?: Options): Website => {
+ const f = options?.faker ?? faker;
+ return f.internet.url();
+};
+
+export const fakeIPv4Address = (options?: Options): IPv4Address => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv4();
+};
+
+export const fakeIPv6Address = (options?: Options): IPv6Address => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv6();
+};
+
+export const fakeZipCode = (options?: Options): ZipCode => {
+ const f = options?.faker ?? faker;
+ return f.helpers.fromRegExp('^\\d{5}(-\\d{4})?$');
+};
+
+export const fakeShortName = (options?: Options): ShortName => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 2, max: 50 } });
+};
+
+export const fakeMinOnlyString = (options?: Options): MinOnlyString => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 10, max: 100 } });
+};
+
+export const fakeMaxOnlyString = (options?: Options): MaxOnlyString => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 0, max: 5 } });
+};
+
+export const fakeEmailWithLength = (options?: Options): EmailWithLength => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeBoundedInt = (options?: Options): BoundedInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeBoundedFloat = (options?: Options): BoundedFloat => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveInt = (options?: Options): ExclusiveInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 9 });
+};
+
+export const fakeMinOnlyNumber = (options?: Options): MinOnlyNumber => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0 });
+};
+
+export const fakeMaxOnlyInt = (options?: Options): MaxOnlyInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ max: 999 });
+};
+
+export const fakeExclusiveFloat = (options?: Options): ExclusiveFloat => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveFloatNarrow = (options?: Options): ExclusiveFloatNarrow => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 10.1, max: 10.2 });
+};
+
+export const fakeTags = (options?: Options): Tags => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeTagList = (options?: Options): TagList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 1, max: 10 } });
+};
+
+export const fakeMinOnlyArray = (options?: Options): MinOnlyArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int(), { count: { min: 3, max: 100 } });
+};
+
+export const fakeMaxOnlyArray = (options?: Options): MaxOnlyArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 0, max: 5 } });
+};
+
+export const fakeDefaultString = (options?: Options): DefaultString => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 'unknown' : f.string.sample();
+};
+
+export const fakeDefaultInt = (options?: Options): DefaultInt => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int();
+};
+
+export const fakeDefaultBool = (options?: Options): DefaultBool => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean();
+};
+
+export const fakeDefaultOverridesConstraints = (options?: Options): DefaultOverridesConstraints => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 42 : f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeNullableString = (options?: Options): NullableString => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.string.sample() : null;
+};
+
+export const fakeNullableInt = (options?: Options): NullableInt => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.number.int() : null;
+};
+
+export const fakeObjectWithDefaultProp = (options?: Options): ObjectWithDefaultProp => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { status: resolveCondition(options?.useDefault ?? false, f) ? 'active' : f.string.sample() }
+ };
+};
+
+export const fakeUserProfile = (options?: Options): UserProfile => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bio: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) }
+ };
+};
+
+export const fakeTag = (options?: Options): Tag => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ label: f.string.sample()
+ };
+};
+
+export const fakePet = (options?: Options): Pet => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ };
+};
+
+export const fakeError = (options?: Options): Error => {
+ const f = options?.faker ?? faker;
+ return {
+ code: f.number.int(),
+ message: f.word.words({ count: 4 })
+ };
+};
+
+export const fakeAddress = (options?: Options): Address => {
+ const f = options?.faker ?? faker;
+ return {
+ street: f.location.streetAddress(),
+ zip: fakeZipCode(options)
+ };
+};
+
+export const fakePerson = (options?: Options): Person => {
+ const f = options?.faker ?? faker;
+ return {
+ name: fakeShortName(options),
+ email: fakeEmail(options),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { address: fakeAddress(options) }
+ };
+};
+
+export const fakePersonList = (options?: Options): PersonList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePerson(options), { count: { min: 1, max: 20 } });
+};
+
+export const fakePetList = (options?: Options): PetList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeTeam = (options?: Options): Team => ({
+ lead: fakePerson(options),
+ config: fakeObjectWithDefaultProp(options)
+});
+
+export const fakePetOrTag = (options?: Options): PetOrTag => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([fakePet(options), fakeTag(options)]);
+};
+
+export const fakeStringOrNumber = (options?: Options): StringOrNumber => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([f.string.sample(), f.number.float()]);
+};
+
+export const fakeNullablePetOrTag = (options?: Options): NullablePetOrTag => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ fakePet(options),
+ fakeTag(options),
+ null
+ ]);
+};
+
+export const fakePetWithOwner = (options?: Options): PetWithOwner => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakePet(options), {
+ owner: f.string.sample()
+ });
+};
+
+export const fakeCircle = (options?: Options): Circle => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ radius: f.number.float()
+ };
+};
+
+export const fakeSquare = (options?: Options): Square => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ side: f.number.float()
+ };
+};
+
+export const fakeShape = (options?: Options): Shape => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeCircle(options)),
+ kind: 'Circle' as const
+ }, {
+ ...Object.assign({}, fakeSquare(options)),
+ kind: 'Square' as const
+ }]);
+};
+
+export const fakeDog = (options?: Options): Dog => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ bark: f.datatype.boolean()
+ };
+};
+
+export const fakeCat = (options?: Options): Cat => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ purr: f.datatype.boolean()
+ };
+};
+
+export const fakeAnimal = (options?: Options): Animal => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeDog(options)),
+ type: 'dog' as const
+ }, {
+ ...Object.assign({}, fakeCat(options)),
+ type: 'cat' as const
+ }]);
+};
+
+export const fakePersonProfile = (options?: Options): PersonProfile => {
+ const f = options?.faker ?? faker;
+ return {
+ firstName: f.person.firstName(),
+ last_name: f.person.lastName(),
+ email: f.internet.email(),
+ phone: f.phone.number(),
+ age: f.number.int({ max: 120, min: 1 }),
+ city: f.location.city(),
+ postalCode: f.location.zipCode(),
+ bio: f.lorem.sentence(),
+ website: f.internet.url(),
+ zipCode: f.helpers.fromRegExp('^\\d{5}$'),
+ username: f.internet.username(),
+ someRandomField: f.string.sample()
+ };
+};
+
+export const fakePersonWithConstraints = (options?: Options): PersonWithConstraints => {
+ const f = options?.faker ?? faker;
+ return {
+ age: f.number.int({ max: 120, min: 18 }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { seniorAge: f.number.int({ min: 65, max: 100 }) }
+ };
+};
+
+export const fakeUser = (options?: Options): User => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.person.fullName(),
+ email: f.internet.email()
+ };
+};
+
+export const fakeCompany = (options?: Options): Company => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.company.name()
+ };
+};
+
+export const fakeConfig = (options?: Options): Config => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample()
+ };
+};
+
+export const fakeNeverArray = (): NeverArray => [];
+
+export const fakeObjectWithOptionalNever = (options?: Options): ObjectWithOptionalNever => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int()
+ };
+};
+
+export const fakeDocument = (options?: Options): Document => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ _id: f.string.uuid(),
+ numericId: f.number.int()
+ };
+};
+
+export const fakeListPetsRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { limit: f.number.int({ min: 1, max: 100 }) }
+ }
+ };
+};
+
+export const fakeListPetsResponse = (options?: Options): ListPetsResponse => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeCreatePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCreatePetResponse = (options?: Options): CreatePetResponse => fakePet(options);
+
+export const fakeDeletePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeDeletePetResponse404 = (options?: Options): DeletePetErrors[404] => fakeError(options);
+
+export const fakeGetPetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeGetPetResponse200 = (options?: Options): GetPetResponses[200] => fakePet(options);
+
+export const fakeGetPetResponse404 = (options?: Options): GetPetErrors[404] => fakeError(options);
+
+export const fakeUpdatePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ },
+ path: {
+ id: f.string.uuid()
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dryRun: f.datatype.boolean() }
+ }
+ };
+};
+
+export const fakeUpdatePetResponse = (options?: Options): UpdatePetResponse => fakePet(options);
+
+export const fakeCreateJobResponse2Xx = (options?: Options): CreateJobResponses['2XX'] => fakePet(options);
+
+export const fakeCreateJobResponse4Xx = (options?: Options): CreateJobErrors['4XX'] => fakeError(options);
+
+export const fakeHealthCheckResponse = (options?: Options): HealthCheckResponse => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/index.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/index.ts
new file mode 100644
index 0000000000..bbd64f9a01
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/index.ts
@@ -0,0 +1,3 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type { Active, Address, Animal, Anything, BoundedFloat, BoundedInt, Cat, Circle, ClientOptions, Company, Config, CreateJobData, CreateJobError, CreateJobErrors, CreateJobResponse, CreateJobResponses, CreatePetData, CreatePetResponse, CreatePetResponses, DateOnly, DateTime, DefaultBool, DefaultInt, DefaultOverridesConstraints, DefaultString, DeletePetData, DeletePetError, DeletePetErrors, DeletePetResponse, DeletePetResponses, Document, Dog, Email, EmailWithLength, Error, ExclusiveFloat, ExclusiveFloatNarrow, ExclusiveInt, GetPetData, GetPetError, GetPetErrors, GetPetResponse, GetPetResponses, HealthCheckData, HealthCheckResponse, HealthCheckResponses, IPv4Address, IPv6Address, ListPetsData, ListPetsResponse, ListPetsResponses, MaxOnlyArray, MaxOnlyInt, MaxOnlyString, MinOnlyArray, MinOnlyNumber, MinOnlyString, NeverArray, NeverTuple, NullableInt, NullablePetOrTag, NullableString, NumericEnum, ObjectWithDefaultProp, ObjectWithOptionalNever, ObjectWithRequiredNever, Person, PersonList, PersonProfile, PersonWithConstraints, Pet, PetList, PetOrTag, PetWithOwner, Price, Quantity, Shape, ShortName, Square, StatusWithNull, StringOrNumber, Tag, TagList, Tags, Team, UniqueId, UpdatePetData, UpdatePetResponse, UpdatePetResponses, User, UserProfile, Website, ZipCode } from './types.gen';
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/types.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/types.gen.ts
new file mode 100644
index 0000000000..5035a69599
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-name-rules/types.gen.ts
@@ -0,0 +1,381 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type ClientOptions = {
+ baseUrl: `${string}://${string}` | (string & {});
+};
+
+export type Price = number;
+
+export type Quantity = number;
+
+export type Active = boolean;
+
+export type Anything = unknown;
+
+export type StatusWithNull = 'active' | 'inactive' | null;
+
+export type NumericEnum = 1 | 2 | 3;
+
+export type Email = string;
+
+export type DateTime = string;
+
+export type DateOnly = string;
+
+export type UniqueId = string;
+
+export type Website = string;
+
+export type IPv4Address = string;
+
+export type IPv6Address = string;
+
+export type ZipCode = string;
+
+export type ShortName = string;
+
+export type MinOnlyString = string;
+
+export type MaxOnlyString = string;
+
+export type EmailWithLength = string;
+
+export type BoundedInt = number;
+
+export type BoundedFloat = number;
+
+export type ExclusiveInt = number;
+
+export type MinOnlyNumber = number;
+
+export type MaxOnlyInt = number;
+
+export type ExclusiveFloat = number;
+
+export type ExclusiveFloatNarrow = number;
+
+export type Tags = Array;
+
+export type TagList = Array;
+
+export type MinOnlyArray = Array;
+
+export type MaxOnlyArray = Array;
+
+export type DefaultString = string;
+
+export type DefaultInt = number;
+
+export type DefaultBool = boolean;
+
+export type DefaultOverridesConstraints = number;
+
+export type NullableString = string | null;
+
+export type NullableInt = number | null;
+
+export type ObjectWithDefaultProp = {
+ name: string;
+ status?: string;
+};
+
+export type UserProfile = {
+ id: number;
+ name: string;
+ bio?: string;
+ age?: number;
+};
+
+export type Pet = {
+ id: string;
+ name: string;
+ age?: number;
+ tag?: Tag;
+};
+
+export type Tag = {
+ id: number;
+ label: string;
+};
+
+export type Error = {
+ code: number;
+ message: string;
+};
+
+export type Address = {
+ street: string;
+ zip: ZipCode;
+};
+
+export type Person = {
+ name: ShortName;
+ email: Email;
+ address?: Address;
+};
+
+export type PersonList = Array;
+
+export type PetList = Array;
+
+export type Team = {
+ lead: Person;
+ config: ObjectWithDefaultProp;
+};
+
+export type PetOrTag = Pet | Tag;
+
+export type StringOrNumber = string | number;
+
+export type NullablePetOrTag = Pet | Tag | null;
+
+export type PetWithOwner = Pet & {
+ owner: string;
+};
+
+export type Circle = {
+ kind: string;
+ radius: number;
+};
+
+export type Square = {
+ kind: string;
+ side: number;
+};
+
+export type Shape = ({
+ kind: 'Circle';
+} & Circle) | ({
+ kind: 'Square';
+} & Square);
+
+export type Dog = {
+ type: string;
+ bark: boolean;
+};
+
+export type Cat = {
+ type: string;
+ purr: boolean;
+};
+
+export type Animal = ({
+ type: 'dog';
+} & Dog) | ({
+ type: 'cat';
+} & Cat);
+
+export type PersonProfile = {
+ firstName: string;
+ last_name: string;
+ email: string;
+ phone: string;
+ age: number;
+ city: string;
+ postalCode: string;
+ bio: string;
+ website: string;
+ zipCode: string;
+ username: string;
+ someRandomField: string;
+};
+
+export type PersonWithConstraints = {
+ age: number;
+ seniorAge?: number;
+};
+
+export type User = {
+ name: string;
+ email: string;
+};
+
+export type Company = {
+ name: string;
+};
+
+export type Config = {
+ name: string;
+};
+
+export type NeverTuple = [
+ number & string,
+ number & string
+];
+
+export type NeverArray = Array;
+
+export type ObjectWithRequiredNever = {
+ id: number;
+ impossible: number & string;
+};
+
+export type ObjectWithOptionalNever = {
+ id: number;
+ impossible?: number & string;
+};
+
+export type Document = {
+ id: string;
+ _id: string;
+ numericId: number;
+};
+
+export type ListPetsData = {
+ body?: never;
+ path?: never;
+ query?: {
+ limit?: number;
+ };
+ url: '/pets';
+};
+
+export type ListPetsResponses = {
+ /**
+ * A list of pets
+ */
+ 200: Array;
+};
+
+export type ListPetsResponse = ListPetsResponses[keyof ListPetsResponses];
+
+export type CreatePetData = {
+ body: {
+ name: string;
+ tag?: string;
+ };
+ path?: never;
+ query?: never;
+ url: '/pets';
+};
+
+export type CreatePetResponses = {
+ /**
+ * Pet created
+ */
+ 201: Pet;
+ /**
+ * No content
+ */
+ 204: void;
+};
+
+export type CreatePetResponse = CreatePetResponses[keyof CreatePetResponses];
+
+export type DeletePetData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/pets/{id}';
+};
+
+export type DeletePetErrors = {
+ /**
+ * Not found
+ */
+ 404: Error;
+};
+
+export type DeletePetError = DeletePetErrors[keyof DeletePetErrors];
+
+export type DeletePetResponses = {
+ /**
+ * Deleted
+ */
+ 204: void;
+};
+
+export type DeletePetResponse = DeletePetResponses[keyof DeletePetResponses];
+
+export type GetPetData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/pets/{id}';
+};
+
+export type GetPetErrors = {
+ /**
+ * Not found
+ */
+ 404: Error;
+};
+
+export type GetPetError = GetPetErrors[keyof GetPetErrors];
+
+export type GetPetResponses = {
+ /**
+ * A pet
+ */
+ 200: Pet;
+};
+
+export type GetPetResponse = GetPetResponses[keyof GetPetResponses];
+
+export type UpdatePetData = {
+ body: {
+ name: string;
+ tag?: Tag;
+ };
+ path: {
+ id: string;
+ };
+ query?: {
+ dryRun?: boolean;
+ };
+ url: '/pets/{id}';
+};
+
+export type UpdatePetResponses = {
+ /**
+ * Updated pet
+ */
+ 200: Pet;
+};
+
+export type UpdatePetResponse = UpdatePetResponses[keyof UpdatePetResponses];
+
+export type CreateJobData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/jobs';
+};
+
+export type CreateJobErrors = {
+ /**
+ * Client error
+ */
+ '4XX': Error;
+};
+
+export type CreateJobError = CreateJobErrors[keyof CreateJobErrors];
+
+export type CreateJobResponses = {
+ /**
+ * Job accepted
+ */
+ '2XX': Pet;
+};
+
+export type CreateJobResponse = CreateJobResponses[keyof CreateJobResponses];
+
+export type HealthCheckData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/health';
+};
+
+export type HealthCheckResponses = {
+ /**
+ * OK
+ */
+ 200: string;
+};
+
+export type HealthCheckResponse = HealthCheckResponses[keyof HealthCheckResponses];
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..729152753f
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/@faker-js/faker.gen.ts
@@ -0,0 +1,502 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import { faker, type Faker } from '@faker-js/faker';
+
+import type { Active, Address, Animal, Anything, BoundedFloat, BoundedInt, Cat, Circle, Company, Config, CreateJobErrors, CreateJobResponses, CreatePetData, CreatePetResponse, DateOnly, DateTime, DefaultBool, DefaultInt, DefaultOverridesConstraints, DefaultString, DeletePetData, DeletePetErrors, Document, Dog, Email, EmailWithLength, Error, ExclusiveFloat, ExclusiveFloatNarrow, ExclusiveInt, GetPetData, GetPetErrors, GetPetResponses, HealthCheckResponse, IPv4Address, IPv6Address, ListPetsData, ListPetsResponse, MaxOnlyArray, MaxOnlyInt, MaxOnlyString, MinOnlyArray, MinOnlyNumber, MinOnlyString, NeverArray, NullableInt, NullablePetOrTag, NullableString, NumericEnum, ObjectWithDefaultProp, ObjectWithOptionalNever, Person, PersonList, PersonProfile, PersonWithConstraints, Pet, PetList, PetOrTag, PetWithOwner, Price, Quantity, Shape, ShortName, Square, StatusWithNull, StringOrNumber, Tag, TagList, Tags, Team, UniqueId, UpdatePetData, UpdatePetResponse, User, UserProfile, Website, ZipCode } from '../types.gen';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakePrice = (options?: Options): Price => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeQuantity = (options?: Options): Quantity => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeActive = (options?: Options): Active => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeAnything = (): Anything => undefined;
+
+export const fakeStatusWithNull = (options?: Options): StatusWithNull => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'active',
+ 'inactive',
+ null
+ ]);
+};
+
+export const fakeNumericEnum = (options?: Options): NumericEnum => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3
+ ]);
+};
+
+export const fakeEmail = (options?: Options): Email => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeDateTime = (options?: Options): DateTime => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString();
+};
+
+export const fakeDateOnly = (options?: Options): DateOnly => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString().slice(0, 10);
+};
+
+export const fakeUniqueId = (options?: Options): UniqueId => {
+ const f = options?.faker ?? faker;
+ return f.string.uuid();
+};
+
+export const fakeWebsite = (options?: Options): Website => {
+ const f = options?.faker ?? faker;
+ return f.internet.url();
+};
+
+export const fakeIPv4Address = (options?: Options): IPv4Address => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv4();
+};
+
+export const fakeIPv6Address = (options?: Options): IPv6Address => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv6();
+};
+
+export const fakeZipCode = (options?: Options): ZipCode => {
+ const f = options?.faker ?? faker;
+ return f.helpers.fromRegExp('^\\d{5}(-\\d{4})?$');
+};
+
+export const fakeShortName = (options?: Options): ShortName => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 2, max: 50 } });
+};
+
+export const fakeMinOnlyString = (options?: Options): MinOnlyString => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 10, max: 100 } });
+};
+
+export const fakeMaxOnlyString = (options?: Options): MaxOnlyString => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 0, max: 5 } });
+};
+
+export const fakeEmailWithLength = (options?: Options): EmailWithLength => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeBoundedInt = (options?: Options): BoundedInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeBoundedFloat = (options?: Options): BoundedFloat => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveInt = (options?: Options): ExclusiveInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 9 });
+};
+
+export const fakeMinOnlyNumber = (options?: Options): MinOnlyNumber => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0 });
+};
+
+export const fakeMaxOnlyInt = (options?: Options): MaxOnlyInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ max: 999 });
+};
+
+export const fakeExclusiveFloat = (options?: Options): ExclusiveFloat => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveFloatNarrow = (options?: Options): ExclusiveFloatNarrow => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 10.1, max: 10.2 });
+};
+
+export const fakeTags = (options?: Options): Tags => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeTagList = (options?: Options): TagList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 1, max: 10 } });
+};
+
+export const fakeMinOnlyArray = (options?: Options): MinOnlyArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int(), { count: { min: 3, max: 100 } });
+};
+
+export const fakeMaxOnlyArray = (options?: Options): MaxOnlyArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 0, max: 5 } });
+};
+
+export const fakeDefaultString = (options?: Options): DefaultString => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 'unknown' : f.string.sample();
+};
+
+export const fakeDefaultInt = (options?: Options): DefaultInt => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int();
+};
+
+export const fakeDefaultBool = (options?: Options): DefaultBool => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean();
+};
+
+export const fakeDefaultOverridesConstraints = (options?: Options): DefaultOverridesConstraints => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 42 : f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeNullableString = (options?: Options): NullableString => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.string.sample() : null;
+};
+
+export const fakeNullableInt = (options?: Options): NullableInt => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.number.int() : null;
+};
+
+export const fakeObjectWithDefaultProp = (options?: Options): ObjectWithDefaultProp => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { status: resolveCondition(options?.useDefault ?? false, f) ? 'active' : f.string.sample() }
+ };
+};
+
+export const fakeUserProfile = (options?: Options): UserProfile => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bio: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) }
+ };
+};
+
+export const fakeTag = (options?: Options): Tag => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ label: f.string.sample()
+ };
+};
+
+export const fakePet = (options?: Options): Pet => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ };
+};
+
+export const fakeError = (options?: Options): Error => {
+ const f = options?.faker ?? faker;
+ return {
+ code: f.number.int(),
+ message: f.string.sample()
+ };
+};
+
+export const fakeAddress = (options?: Options): Address => {
+ const f = options?.faker ?? faker;
+ return {
+ street: f.location.streetAddress(),
+ zip: fakeZipCode(options)
+ };
+};
+
+export const fakePerson = (options?: Options): Person => {
+ const f = options?.faker ?? faker;
+ return {
+ name: fakeShortName(options),
+ email: fakeEmail(options),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { address: fakeAddress(options) }
+ };
+};
+
+export const fakePersonList = (options?: Options): PersonList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePerson(options), { count: { min: 1, max: 20 } });
+};
+
+export const fakePetList = (options?: Options): PetList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeTeam = (options?: Options): Team => ({
+ lead: fakePerson(options),
+ config: fakeObjectWithDefaultProp(options)
+});
+
+export const fakePetOrTag = (options?: Options): PetOrTag => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([fakePet(options), fakeTag(options)]);
+};
+
+export const fakeStringOrNumber = (options?: Options): StringOrNumber => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([f.string.sample(), f.number.float()]);
+};
+
+export const fakeNullablePetOrTag = (options?: Options): NullablePetOrTag => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ fakePet(options),
+ fakeTag(options),
+ null
+ ]);
+};
+
+export const fakePetWithOwner = (options?: Options): PetWithOwner => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakePet(options), {
+ owner: f.string.sample()
+ });
+};
+
+export const fakeCircle = (options?: Options): Circle => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ radius: f.number.float()
+ };
+};
+
+export const fakeSquare = (options?: Options): Square => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ side: f.number.float()
+ };
+};
+
+export const fakeShape = (options?: Options): Shape => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeCircle(options)),
+ kind: 'Circle' as const
+ }, {
+ ...Object.assign({}, fakeSquare(options)),
+ kind: 'Square' as const
+ }]);
+};
+
+export const fakeDog = (options?: Options): Dog => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ bark: f.datatype.boolean()
+ };
+};
+
+export const fakeCat = (options?: Options): Cat => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ purr: f.datatype.boolean()
+ };
+};
+
+export const fakeAnimal = (options?: Options): Animal => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeDog(options)),
+ type: 'dog' as const
+ }, {
+ ...Object.assign({}, fakeCat(options)),
+ type: 'cat' as const
+ }]);
+};
+
+export const fakePersonProfile = (options?: Options): PersonProfile => {
+ const f = options?.faker ?? faker;
+ return {
+ firstName: f.person.firstName(),
+ last_name: f.person.lastName(),
+ email: f.internet.email(),
+ phone: f.phone.number(),
+ age: f.number.int({ max: 120, min: 1 }),
+ city: f.location.city(),
+ postalCode: f.location.zipCode(),
+ bio: f.lorem.sentence(),
+ website: f.internet.url(),
+ zipCode: f.helpers.fromRegExp('^\\d{5}$'),
+ username: f.internet.username(),
+ someRandomField: f.string.sample()
+ };
+};
+
+export const fakePersonWithConstraints = (options?: Options): PersonWithConstraints => {
+ const f = options?.faker ?? faker;
+ return {
+ age: f.number.int({ max: 120, min: 18 }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { seniorAge: f.number.int({ min: 65, max: 100 }) }
+ };
+};
+
+export const fakeUser = (options?: Options): User => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.person.fullName(),
+ email: f.internet.email()
+ };
+};
+
+export const fakeCompany = (options?: Options): Company => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.company.name()
+ };
+};
+
+export const fakeConfig = (options?: Options): Config => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample()
+ };
+};
+
+export const fakeNeverArray = (): NeverArray => [];
+
+export const fakeObjectWithOptionalNever = (options?: Options): ObjectWithOptionalNever => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int()
+ };
+};
+
+export const fakeDocument = (options?: Options): Document => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ _id: f.string.uuid(),
+ numericId: f.number.int()
+ };
+};
+
+export const fakeListPetsRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { limit: f.number.int({ min: 1, max: 100 }) }
+ }
+ };
+};
+
+export const fakeListPetsResponse = (options?: Options): ListPetsResponse => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeCreatePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCreatePetResponse = (options?: Options): CreatePetResponse => fakePet(options);
+
+export const fakeDeletePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeDeletePetResponse404 = (options?: Options): DeletePetErrors[404] => fakeError(options);
+
+export const fakeGetPetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeGetPetResponse200 = (options?: Options): GetPetResponses[200] => fakePet(options);
+
+export const fakeGetPetResponse404 = (options?: Options): GetPetErrors[404] => fakeError(options);
+
+export const fakeUpdatePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ },
+ path: {
+ id: f.string.uuid()
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dryRun: f.datatype.boolean() }
+ }
+ };
+};
+
+export const fakeUpdatePetResponse = (options?: Options): UpdatePetResponse => fakePet(options);
+
+export const fakeCreateJobResponse2Xx = (options?: Options): CreateJobResponses['2XX'] => fakePet(options);
+
+export const fakeCreateJobResponse4Xx = (options?: Options): CreateJobErrors['4XX'] => fakeError(options);
+
+export const fakeHealthCheckResponse = (options?: Options): HealthCheckResponse => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/index.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/index.ts
new file mode 100644
index 0000000000..bbd64f9a01
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/index.ts
@@ -0,0 +1,3 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type { Active, Address, Animal, Anything, BoundedFloat, BoundedInt, Cat, Circle, ClientOptions, Company, Config, CreateJobData, CreateJobError, CreateJobErrors, CreateJobResponse, CreateJobResponses, CreatePetData, CreatePetResponse, CreatePetResponses, DateOnly, DateTime, DefaultBool, DefaultInt, DefaultOverridesConstraints, DefaultString, DeletePetData, DeletePetError, DeletePetErrors, DeletePetResponse, DeletePetResponses, Document, Dog, Email, EmailWithLength, Error, ExclusiveFloat, ExclusiveFloatNarrow, ExclusiveInt, GetPetData, GetPetError, GetPetErrors, GetPetResponse, GetPetResponses, HealthCheckData, HealthCheckResponse, HealthCheckResponses, IPv4Address, IPv6Address, ListPetsData, ListPetsResponse, ListPetsResponses, MaxOnlyArray, MaxOnlyInt, MaxOnlyString, MinOnlyArray, MinOnlyNumber, MinOnlyString, NeverArray, NeverTuple, NullableInt, NullablePetOrTag, NullableString, NumericEnum, ObjectWithDefaultProp, ObjectWithOptionalNever, ObjectWithRequiredNever, Person, PersonList, PersonProfile, PersonWithConstraints, Pet, PetList, PetOrTag, PetWithOwner, Price, Quantity, Shape, ShortName, Square, StatusWithNull, StringOrNumber, Tag, TagList, Tags, Team, UniqueId, UpdatePetData, UpdatePetResponse, UpdatePetResponses, User, UserProfile, Website, ZipCode } from './types.gen';
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/types.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/types.gen.ts
new file mode 100644
index 0000000000..5035a69599
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker-typed/types.gen.ts
@@ -0,0 +1,381 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type ClientOptions = {
+ baseUrl: `${string}://${string}` | (string & {});
+};
+
+export type Price = number;
+
+export type Quantity = number;
+
+export type Active = boolean;
+
+export type Anything = unknown;
+
+export type StatusWithNull = 'active' | 'inactive' | null;
+
+export type NumericEnum = 1 | 2 | 3;
+
+export type Email = string;
+
+export type DateTime = string;
+
+export type DateOnly = string;
+
+export type UniqueId = string;
+
+export type Website = string;
+
+export type IPv4Address = string;
+
+export type IPv6Address = string;
+
+export type ZipCode = string;
+
+export type ShortName = string;
+
+export type MinOnlyString = string;
+
+export type MaxOnlyString = string;
+
+export type EmailWithLength = string;
+
+export type BoundedInt = number;
+
+export type BoundedFloat = number;
+
+export type ExclusiveInt = number;
+
+export type MinOnlyNumber = number;
+
+export type MaxOnlyInt = number;
+
+export type ExclusiveFloat = number;
+
+export type ExclusiveFloatNarrow = number;
+
+export type Tags = Array;
+
+export type TagList = Array;
+
+export type MinOnlyArray = Array;
+
+export type MaxOnlyArray = Array;
+
+export type DefaultString = string;
+
+export type DefaultInt = number;
+
+export type DefaultBool = boolean;
+
+export type DefaultOverridesConstraints = number;
+
+export type NullableString = string | null;
+
+export type NullableInt = number | null;
+
+export type ObjectWithDefaultProp = {
+ name: string;
+ status?: string;
+};
+
+export type UserProfile = {
+ id: number;
+ name: string;
+ bio?: string;
+ age?: number;
+};
+
+export type Pet = {
+ id: string;
+ name: string;
+ age?: number;
+ tag?: Tag;
+};
+
+export type Tag = {
+ id: number;
+ label: string;
+};
+
+export type Error = {
+ code: number;
+ message: string;
+};
+
+export type Address = {
+ street: string;
+ zip: ZipCode;
+};
+
+export type Person = {
+ name: ShortName;
+ email: Email;
+ address?: Address;
+};
+
+export type PersonList = Array;
+
+export type PetList = Array;
+
+export type Team = {
+ lead: Person;
+ config: ObjectWithDefaultProp;
+};
+
+export type PetOrTag = Pet | Tag;
+
+export type StringOrNumber = string | number;
+
+export type NullablePetOrTag = Pet | Tag | null;
+
+export type PetWithOwner = Pet & {
+ owner: string;
+};
+
+export type Circle = {
+ kind: string;
+ radius: number;
+};
+
+export type Square = {
+ kind: string;
+ side: number;
+};
+
+export type Shape = ({
+ kind: 'Circle';
+} & Circle) | ({
+ kind: 'Square';
+} & Square);
+
+export type Dog = {
+ type: string;
+ bark: boolean;
+};
+
+export type Cat = {
+ type: string;
+ purr: boolean;
+};
+
+export type Animal = ({
+ type: 'dog';
+} & Dog) | ({
+ type: 'cat';
+} & Cat);
+
+export type PersonProfile = {
+ firstName: string;
+ last_name: string;
+ email: string;
+ phone: string;
+ age: number;
+ city: string;
+ postalCode: string;
+ bio: string;
+ website: string;
+ zipCode: string;
+ username: string;
+ someRandomField: string;
+};
+
+export type PersonWithConstraints = {
+ age: number;
+ seniorAge?: number;
+};
+
+export type User = {
+ name: string;
+ email: string;
+};
+
+export type Company = {
+ name: string;
+};
+
+export type Config = {
+ name: string;
+};
+
+export type NeverTuple = [
+ number & string,
+ number & string
+];
+
+export type NeverArray = Array;
+
+export type ObjectWithRequiredNever = {
+ id: number;
+ impossible: number & string;
+};
+
+export type ObjectWithOptionalNever = {
+ id: number;
+ impossible?: number & string;
+};
+
+export type Document = {
+ id: string;
+ _id: string;
+ numericId: number;
+};
+
+export type ListPetsData = {
+ body?: never;
+ path?: never;
+ query?: {
+ limit?: number;
+ };
+ url: '/pets';
+};
+
+export type ListPetsResponses = {
+ /**
+ * A list of pets
+ */
+ 200: Array;
+};
+
+export type ListPetsResponse = ListPetsResponses[keyof ListPetsResponses];
+
+export type CreatePetData = {
+ body: {
+ name: string;
+ tag?: string;
+ };
+ path?: never;
+ query?: never;
+ url: '/pets';
+};
+
+export type CreatePetResponses = {
+ /**
+ * Pet created
+ */
+ 201: Pet;
+ /**
+ * No content
+ */
+ 204: void;
+};
+
+export type CreatePetResponse = CreatePetResponses[keyof CreatePetResponses];
+
+export type DeletePetData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/pets/{id}';
+};
+
+export type DeletePetErrors = {
+ /**
+ * Not found
+ */
+ 404: Error;
+};
+
+export type DeletePetError = DeletePetErrors[keyof DeletePetErrors];
+
+export type DeletePetResponses = {
+ /**
+ * Deleted
+ */
+ 204: void;
+};
+
+export type DeletePetResponse = DeletePetResponses[keyof DeletePetResponses];
+
+export type GetPetData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/pets/{id}';
+};
+
+export type GetPetErrors = {
+ /**
+ * Not found
+ */
+ 404: Error;
+};
+
+export type GetPetError = GetPetErrors[keyof GetPetErrors];
+
+export type GetPetResponses = {
+ /**
+ * A pet
+ */
+ 200: Pet;
+};
+
+export type GetPetResponse = GetPetResponses[keyof GetPetResponses];
+
+export type UpdatePetData = {
+ body: {
+ name: string;
+ tag?: Tag;
+ };
+ path: {
+ id: string;
+ };
+ query?: {
+ dryRun?: boolean;
+ };
+ url: '/pets/{id}';
+};
+
+export type UpdatePetResponses = {
+ /**
+ * Updated pet
+ */
+ 200: Pet;
+};
+
+export type UpdatePetResponse = UpdatePetResponses[keyof UpdatePetResponses];
+
+export type CreateJobData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/jobs';
+};
+
+export type CreateJobErrors = {
+ /**
+ * Client error
+ */
+ '4XX': Error;
+};
+
+export type CreateJobError = CreateJobErrors[keyof CreateJobErrors];
+
+export type CreateJobResponses = {
+ /**
+ * Job accepted
+ */
+ '2XX': Pet;
+};
+
+export type CreateJobResponse = CreateJobResponses[keyof CreateJobResponses];
+
+export type HealthCheckData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/health';
+};
+
+export type HealthCheckResponses = {
+ /**
+ * OK
+ */
+ 200: string;
+};
+
+export type HealthCheckResponse = HealthCheckResponses[keyof HealthCheckResponses];
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..8fa5bebd3f
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.0.x/faker/@faker-js/faker.gen.ts
@@ -0,0 +1,500 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import { faker, type Faker } from '@faker-js/faker';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakePrice = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeQuantity = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeActive = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeAnything = () => undefined;
+
+export const fakeStatusWithNull = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'active',
+ 'inactive',
+ null
+ ]);
+};
+
+export const fakeNumericEnum = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3
+ ]);
+};
+
+export const fakeEmail = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeDateTime = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString();
+};
+
+export const fakeDateOnly = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString().slice(0, 10);
+};
+
+export const fakeUniqueId = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.uuid();
+};
+
+export const fakeWebsite = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.url();
+};
+
+export const fakeIPv4Address = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv4();
+};
+
+export const fakeIPv6Address = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv6();
+};
+
+export const fakeZipCode = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.fromRegExp('^\\d{5}(-\\d{4})?$');
+};
+
+export const fakeShortName = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 2, max: 50 } });
+};
+
+export const fakeMinOnlyString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 10, max: 100 } });
+};
+
+export const fakeMaxOnlyString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 0, max: 5 } });
+};
+
+export const fakeEmailWithLength = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeBoundedInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeBoundedFloat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 9 });
+};
+
+export const fakeMinOnlyNumber = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0 });
+};
+
+export const fakeMaxOnlyInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ max: 999 });
+};
+
+export const fakeExclusiveFloat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveFloatNarrow = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 10.1, max: 10.2 });
+};
+
+export const fakeTags = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeTagList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 1, max: 10 } });
+};
+
+export const fakeMinOnlyArray = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int(), { count: { min: 3, max: 100 } });
+};
+
+export const fakeMaxOnlyArray = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 0, max: 5 } });
+};
+
+export const fakeDefaultString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 'unknown' : f.string.sample();
+};
+
+export const fakeDefaultInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int();
+};
+
+export const fakeDefaultBool = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean();
+};
+
+export const fakeDefaultOverridesConstraints = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 42 : f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeNullableString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.string.sample() : null;
+};
+
+export const fakeNullableInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.number.int() : null;
+};
+
+export const fakeObjectWithDefaultProp = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { status: resolveCondition(options?.useDefault ?? false, f) ? 'active' : f.string.sample() }
+ };
+};
+
+export const fakeUserProfile = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bio: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) }
+ };
+};
+
+export const fakeTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ label: f.string.sample()
+ };
+};
+
+export const fakePet = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ };
+};
+
+export const fakeError = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ code: f.number.int(),
+ message: f.string.sample()
+ };
+};
+
+export const fakeAddress = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ street: f.location.streetAddress(),
+ zip: fakeZipCode(options)
+ };
+};
+
+export const fakePerson = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: fakeShortName(options),
+ email: fakeEmail(options),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { address: fakeAddress(options) }
+ };
+};
+
+export const fakePersonList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePerson(options), { count: { min: 1, max: 20 } });
+};
+
+export const fakePetList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeTeam = (options?: Options) => ({
+ lead: fakePerson(options),
+ config: fakeObjectWithDefaultProp(options)
+});
+
+export const fakePetOrTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([fakePet(options), fakeTag(options)]);
+};
+
+export const fakeStringOrNumber = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([f.string.sample(), f.number.float()]);
+};
+
+export const fakeNullablePetOrTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ fakePet(options),
+ fakeTag(options),
+ null
+ ]);
+};
+
+export const fakePetWithOwner = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakePet(options), {
+ owner: f.string.sample()
+ });
+};
+
+export const fakeCircle = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ radius: f.number.float()
+ };
+};
+
+export const fakeSquare = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ side: f.number.float()
+ };
+};
+
+export const fakeShape = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeCircle(options)),
+ kind: 'Circle' as const
+ }, {
+ ...Object.assign({}, fakeSquare(options)),
+ kind: 'Square' as const
+ }]);
+};
+
+export const fakeDog = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ bark: f.datatype.boolean()
+ };
+};
+
+export const fakeCat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ purr: f.datatype.boolean()
+ };
+};
+
+export const fakeAnimal = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeDog(options)),
+ type: 'dog' as const
+ }, {
+ ...Object.assign({}, fakeCat(options)),
+ type: 'cat' as const
+ }]);
+};
+
+export const fakePersonProfile = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ firstName: f.person.firstName(),
+ last_name: f.person.lastName(),
+ email: f.internet.email(),
+ phone: f.phone.number(),
+ age: f.number.int({ max: 120, min: 1 }),
+ city: f.location.city(),
+ postalCode: f.location.zipCode(),
+ bio: f.lorem.sentence(),
+ website: f.internet.url(),
+ zipCode: f.helpers.fromRegExp('^\\d{5}$'),
+ username: f.internet.username(),
+ someRandomField: f.string.sample()
+ };
+};
+
+export const fakePersonWithConstraints = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ age: f.number.int({ max: 120, min: 18 }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { seniorAge: f.number.int({ min: 65, max: 100 }) }
+ };
+};
+
+export const fakeUser = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.person.fullName(),
+ email: f.internet.email()
+ };
+};
+
+export const fakeCompany = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.company.name()
+ };
+};
+
+export const fakeConfig = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample()
+ };
+};
+
+export const fakeNeverArray = () => [];
+
+export const fakeObjectWithOptionalNever = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int()
+ };
+};
+
+export const fakeDocument = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ _id: f.string.uuid(),
+ numericId: f.number.int()
+ };
+};
+
+export const fakeListPetsRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { limit: f.number.int({ min: 1, max: 100 }) }
+ }
+ };
+};
+
+export const fakeListPetsResponse = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeCreatePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCreatePetResponse = (options?: Options) => fakePet(options);
+
+export const fakeDeletePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeDeletePetResponse404 = (options?: Options) => fakeError(options);
+
+export const fakeGetPetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeGetPetResponse200 = (options?: Options) => fakePet(options);
+
+export const fakeGetPetResponse404 = (options?: Options) => fakeError(options);
+
+export const fakeUpdatePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ },
+ path: {
+ id: f.string.uuid()
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dryRun: f.datatype.boolean() }
+ }
+ };
+};
+
+export const fakeUpdatePetResponse = (options?: Options) => fakePet(options);
+
+export const fakeCreateJobResponse2Xx = (options?: Options) => fakePet(options);
+
+export const fakeCreateJobResponse4Xx = (options?: Options) => fakeError(options);
+
+export const fakeHealthCheckResponse = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..dd5878d330
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/@faker-js/faker.gen.ts
@@ -0,0 +1,100 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import { faker, type Faker } from '@faker-js/faker';
+
+import type { Comment, Department, Employee, Member, Org, Pair, Project, TreeNode, Wrapper } from '../types.gen';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const MAX_CALL_DEPTH = 10;
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakeTreeNode = (options: Options = {}, _callDepth = 0): TreeNode => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ value: f.string.sample(),
+ ..._callDepth > MAX_CALL_DEPTH || !resolveCondition(options?.includeOptional ?? true, f) ? {} : { children: _callDepth > MAX_CALL_DEPTH ? [] : f.helpers.multiple(() => fakeTreeNode(options, _callDepth + 1)) }
+ };
+};
+
+export const fakeWrapper = (options?: Options): Wrapper => {
+ const f = options?.faker ?? faker;
+ return {
+ label: f.string.sample(),
+ tree: fakeTreeNode(options)
+ };
+};
+
+export const fakePair = (options?: Options): Pair => ({
+ nodes: [fakeTreeNode(options), fakeTreeNode(options)]
+});
+
+export const fakeComment = (options: Options = {}, _callDepth = 0): Comment => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ text: f.string.sample(),
+ parent: _callDepth > MAX_CALL_DEPTH ? null : f.datatype.boolean() ? fakeComment(options, _callDepth + 1) : null
+ };
+};
+
+export const fakeOrg = (options: Options = {}, _callDepth = 0): Org => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ..._callDepth > MAX_CALL_DEPTH || !resolveCondition(options?.includeOptional ?? true, f) ? {} : { members: _callDepth > MAX_CALL_DEPTH ? [] : f.helpers.multiple(() => fakeMember(options, _callDepth + 1)) }
+ };
+};
+
+export const fakeMember = (options: Options = {}, _callDepth = 0): Member => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ..._callDepth > MAX_CALL_DEPTH || !resolveCondition(options?.includeOptional ?? true, f) ? {} : { org: fakeOrg(options, _callDepth + 1) }
+ };
+};
+
+export const fakeDepartment = (options: Options = {}, _callDepth = 0): Department => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ..._callDepth > MAX_CALL_DEPTH || !resolveCondition(options?.includeOptional ?? true, f) ? {} : { employees: _callDepth > MAX_CALL_DEPTH ? [] : f.helpers.multiple(() => fakeEmployee(options, _callDepth + 1)) }
+ };
+};
+
+export const fakeEmployee = (options: Options = {}, _callDepth = 0): Employee => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.person.fullName(),
+ projects: _callDepth > MAX_CALL_DEPTH ? [] : f.helpers.multiple(() => fakeProject(options, _callDepth + 1))
+ };
+};
+
+export const fakeProject = (options: Options = {}, _callDepth = 0): Project => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ..._callDepth > MAX_CALL_DEPTH || !resolveCondition(options?.includeOptional ?? true, f) ? {} : { department: fakeDepartment(options, _callDepth + 1) }
+ };
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/index.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/index.ts
new file mode 100644
index 0000000000..e5979c33bb
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/index.ts
@@ -0,0 +1,3 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type { ClientOptions, Comment, Department, Employee, Member, Org, Pair, Project, TreeNode, Wrapper } from './types.gen';
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/types.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/types.gen.ts
new file mode 100644
index 0000000000..418558bafe
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-circular/types.gen.ts
@@ -0,0 +1,59 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type ClientOptions = {
+ baseUrl: `${string}://${string}` | (string & {});
+};
+
+export type TreeNode = {
+ id: string;
+ value: string;
+ children?: Array;
+};
+
+export type Org = {
+ id: string;
+ name: string;
+ members?: Array;
+};
+
+export type Member = {
+ id: string;
+ name: string;
+ org?: Org;
+};
+
+export type Department = {
+ id: string;
+ name: string;
+ employees?: Array;
+};
+
+export type Employee = {
+ id: string;
+ name: string;
+ projects: Array;
+};
+
+export type Project = {
+ id: string;
+ name: string;
+ department?: Department;
+};
+
+export type Wrapper = {
+ label: string;
+ tree: TreeNode;
+};
+
+export type Pair = {
+ nodes: [
+ TreeNode,
+ TreeNode
+ ];
+};
+
+export type Comment = {
+ id: string;
+ text: string;
+ parent: Comment | null;
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..dee95747d0
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/@faker-js/faker.gen.ts
@@ -0,0 +1,1617 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import { faker, type Faker } from '@faker-js/faker';
+
+import type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountResponse, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponses, CallWithParametersData, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithResponsesErrors, CallWithResponsesResponses, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAResponse, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExternalRefA, ExternalRefB, ExternalSharedModel, File, FileResponseData, FileResponseResponse, FileWritable, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, Import, ImportData, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAdditionalPropertiesRef, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseResponse, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, Pageable, ParameterSimpleParameterUnused, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponses, UploadFileData, UploadFileResponse, XFooBar } from '../types.gen';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const MAX_CALL_DEPTH = 10;
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fake400 = (options?: Options): _400 => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeCamelCaseCommentWithBreaks = (options?: Options): CamelCaseCommentWithBreaks => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeCommentWithBreaks = (options?: Options): CommentWithBreaks => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeCommentWithBackticks = (options?: Options): CommentWithBackticks => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeCommentWithBackticksAndQuotes = (options?: Options): CommentWithBackticksAndQuotes => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeCommentWithSlashes = (options?: Options): CommentWithSlashes => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeCommentWithExpressionPlaceholders = (options?: Options): CommentWithExpressionPlaceholders => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeCommentWithQuotes = (options?: Options): CommentWithQuotes => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeCommentWithReservedCharacters = (options?: Options): CommentWithReservedCharacters => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeSimpleInteger = (options?: Options): SimpleInteger => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeSimpleBoolean = (options?: Options): SimpleBoolean => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeSimpleString = (options?: Options): SimpleString => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeNonAsciiStringæøåÆøÅöôêÊ字符串 = (options?: Options): NonAsciiStringæøåÆøÅöôêÊ字符串 => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeSimpleFile = (options?: Options): SimpleFile => {
+ const f = options?.faker ?? faker;
+ return new Blob([f.image.dataUri()]);
+};
+
+export const fakeSimpleStringWithPattern = (options?: Options): SimpleStringWithPattern => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.helpers.fromRegExp('^[a-zA-Z0-9_]*$') : null;
+};
+
+export const fakeEnumWithStrings = (options?: Options): EnumWithStrings => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error',
+ '\'Single Quote\'',
+ '"Double Quotes"',
+ 'Non-ascii: øæåôöØÆÅÔÖ字符串'
+ ]);
+};
+
+export const fakeEnumWithReplacedCharacters = (options?: Options): EnumWithReplacedCharacters => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ '\'Single Quote\'',
+ '"Double Quotes"',
+ 'øæåôöØÆÅÔÖ字符串',
+ 3.1,
+ ''
+ ]);
+};
+
+export const fakeEnumWithNumbers = (options?: Options): EnumWithNumbers => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3,
+ 1.1,
+ 1.2,
+ 1.3,
+ 100,
+ 200,
+ 300,
+ -100,
+ -200,
+ -300,
+ -1.1,
+ -1.2,
+ -1.3
+ ]);
+};
+
+export const fakeEnumFromDescription = (options?: Options): EnumFromDescription => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeEnumWithExtensions = (options?: Options): EnumWithExtensions => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 200,
+ 400,
+ 500
+ ]);
+};
+
+export const fakeEnumWithXEnumNames = (options?: Options): EnumWithXEnumNames => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 0,
+ 1,
+ 2
+ ]);
+};
+
+export const fakeArrayWithNumbers = (options?: Options): ArrayWithNumbers => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int());
+};
+
+export const fakeArrayWithBooleans = (options?: Options): ArrayWithBooleans => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.datatype.boolean());
+};
+
+export const fakeArrayWithStrings = (options?: Options): ArrayWithStrings => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? ['test'] : f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeArrayWithProperties = (options?: Options): ArrayWithProperties => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => ({
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { '16x16': fakeCamelCaseCommentWithBreaks(options) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bar: f.string.sample() }
+ }));
+};
+
+export const fakeArrayWithAnyOfProperties = (options?: Options): ArrayWithAnyOfProperties => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.helpers.arrayElement([{
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo: resolveCondition(options?.useDefault ?? false, f) ? 'test' : f.string.sample() }
+ }, {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bar: f.string.sample() }
+ }]));
+};
+
+export const fakeAnyOfAnyAndNull = (options?: Options): AnyOfAnyAndNull => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { data: f.datatype.boolean() ? undefined : null }
+ };
+};
+
+export const fakeAnyOfArrays = (options?: Options): AnyOfArrays => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { results: f.helpers.multiple(() => f.helpers.arrayElement([{
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo: f.string.sample() }
+ }, {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bar: f.string.sample() }
+ }])) }
+ };
+};
+
+export const fakeDictionaryWithString = (options?: Options): DictionaryWithString => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.string.sample()
+ };
+};
+
+export const fakeDictionaryWithPropertiesAndAdditionalProperties = (options?: Options): DictionaryWithPropertiesAndAdditionalProperties => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo: f.number.float() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bar: f.datatype.boolean() }
+ };
+};
+
+export const fakeDictionaryWithDictionary = (options?: Options): DictionaryWithDictionary => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.string.sample()
+ }
+ };
+};
+
+export const fakeDictionaryWithProperties = (options?: Options): DictionaryWithProperties => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bar: f.string.sample() }
+ }
+ };
+};
+
+export const fakeModelWithInteger = (options?: Options): ModelWithInteger => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.number.int() }
+ };
+};
+
+export const fakeModelWithBoolean = (options?: Options): ModelWithBoolean => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.datatype.boolean() }
+ };
+};
+
+export const fakeModelWithString = (options?: Options): ModelWithString => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.string.sample() }
+ };
+};
+
+export const fakeSimpleReference = (options?: Options): SimpleReference => fakeModelWithString(options);
+
+export const fakeArrayWithReferences = (options?: Options): ArrayWithReferences => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakeModelWithString(options));
+};
+
+export const fakeArrayWithArray = (options?: Options): ArrayWithArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.helpers.multiple(() => fakeModelWithString(options)));
+};
+
+export const fakeDictionaryWithReference = (options?: Options): DictionaryWithReference => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: fakeModelWithString(options)
+ };
+};
+
+export const fakeDictionaryWithArray = (options?: Options): DictionaryWithArray => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.helpers.multiple(() => fakeModelWithString(options))
+ };
+};
+
+export const fakeModelWithStringError = (options?: Options): ModelWithStringError => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.string.sample() }
+ };
+};
+
+export const fakeModelFromZendesk = (options?: Options): ModelFromZendesk => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeModelWithNullableString = (options?: Options): ModelWithNullableString => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { nullableProp1: f.datatype.boolean() ? f.string.sample() : null },
+ nullableRequiredProp1: f.datatype.boolean() ? f.string.sample() : null,
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { nullableProp2: f.datatype.boolean() ? f.string.sample() : null },
+ nullableRequiredProp2: f.datatype.boolean() ? f.string.sample() : null,
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'foo_bar-enum': f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error',
+ 'ØÆÅ字符串'
+ ]) }
+ };
+};
+
+export const fakeModelWithEnum = (options?: Options): ModelWithEnum => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'foo_bar-enum': f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error',
+ 'ØÆÅ字符串'
+ ]) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { statusCode: f.helpers.arrayElement([
+ '100',
+ '200 FOO',
+ '300 FOO_BAR',
+ '400 foo-bar',
+ '500 foo.bar',
+ '600 foo&bar'
+ ]) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bool: true }
+ };
+};
+
+export const fakeModelWithEnumWithHyphen = (options?: Options): ModelWithEnumWithHyphen => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'foo-bar-baz-qux': '3.0' }
+ };
+};
+
+export const fakeModelWithEnumFromDescription = (options?: Options): ModelWithEnumFromDescription => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { test: f.number.int() }
+ };
+};
+
+export const fakeModelWithNestedEnums = (options?: Options): ModelWithNestedEnums => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dictionaryWithEnum: !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error'
+ ])
+ } },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dictionaryWithEnumFromDescription: !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.number.int()
+ } },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { arrayWithEnum: f.helpers.multiple(() => f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error'
+ ])) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { arrayWithDescription: f.helpers.multiple(() => f.number.int()) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'foo_bar-enum': f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error',
+ 'ØÆÅ字符串'
+ ]) }
+ };
+};
+
+export const fakeModelWithArray = (options?: Options): ModelWithArray => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.helpers.multiple(() => fakeModelWithString(options)) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propWithFile: f.helpers.multiple(() => new Blob([f.image.dataUri()])) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propWithNumber: f.helpers.multiple(() => f.number.float()) }
+ };
+};
+
+export const fakeModelWithDictionary = (options?: Options): ModelWithDictionary => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.string.sample()
+ } }
+ };
+};
+
+export const fakeDeprecatedModel = (options?: Options): DeprecatedModel => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.string.sample() }
+ };
+};
+
+export const fakeModelWithCircularReference = (options: Options = {}, _callDepth = 0): ModelWithCircularReference => {
+ const f = options?.faker ?? faker;
+ return {
+ ..._callDepth > MAX_CALL_DEPTH || !resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: fakeModelWithCircularReference(options, _callDepth + 1) }
+ };
+};
+
+export const fakeCompositionWithOneOf = (options?: Options): CompositionWithOneOf => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([
+ fakeModelWithString(options),
+ fakeModelWithEnum(options),
+ fakeModelWithArray(options),
+ fakeModelWithDictionary(options)
+ ]) }
+ };
+};
+
+export const fakeCompositionWithOneOfAnonymous = (options?: Options): CompositionWithOneOfAnonymous => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([
+ {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.string.sample() }
+ },
+ f.string.sample(),
+ f.number.int()
+ ]) }
+ };
+};
+
+export const fakeModelCircle = (options?: Options): ModelCircle => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { radius: f.number.float() }
+ };
+};
+
+export const fakeModelSquare = (options?: Options): ModelSquare => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { sideLength: f.number.float() }
+ };
+};
+
+export const fakeCompositionWithOneOfDiscriminator = (options?: Options): CompositionWithOneOfDiscriminator => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeModelCircle(options)),
+ kind: 'circle' as const
+ }, {
+ ...Object.assign({}, fakeModelSquare(options)),
+ kind: 'square' as const
+ }]);
+};
+
+export const fakeCompositionWithAnyOf = (options?: Options): CompositionWithAnyOf => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([
+ fakeModelWithString(options),
+ fakeModelWithEnum(options),
+ fakeModelWithArray(options),
+ fakeModelWithDictionary(options)
+ ]) }
+ };
+};
+
+export const fakeCompositionWithAnyOfAnonymous = (options?: Options): CompositionWithAnyOfAnonymous => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([
+ {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.string.sample() }
+ },
+ f.string.sample(),
+ f.number.int()
+ ]) }
+ };
+};
+
+export const fakeCompositionWithNestedAnyAndTypeNull = (options?: Options): CompositionWithNestedAnyAndTypeNull => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([f.helpers.multiple(() => f.datatype.boolean() ? fakeModelWithDictionary(options) : null), f.helpers.multiple(() => f.datatype.boolean() ? fakeModelWithArray(options) : null)]) }
+ };
+};
+
+export const fake3eNum1Период = (options?: Options): _3eNum1Период => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement(['Bird', 'Dog']);
+};
+
+export const fakeConstValue = (): ConstValue => 'ConstValue';
+
+export const fakeCompositionWithNestedAnyOfAndNull = (options?: Options): CompositionWithNestedAnyOfAndNull => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.datatype.boolean() ? f.helpers.multiple(() => f.helpers.arrayElement([fake3eNum1Период(options), fakeConstValue()])) : null }
+ };
+};
+
+export const fakeCompositionWithOneOfAndNullable = (options?: Options): CompositionWithOneOfAndNullable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([
+ {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { boolean: f.datatype.boolean() }
+ },
+ fakeModelWithEnum(options),
+ fakeModelWithArray(options),
+ fakeModelWithDictionary(options),
+ null
+ ]) }
+ };
+};
+
+export const fakeCompositionWithOneOfAndSimpleDictionary = (options?: Options): CompositionWithOneOfAndSimpleDictionary => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([f.datatype.boolean(), !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.number.float()
+ }]) }
+ };
+};
+
+export const fakeCompositionWithOneOfAndSimpleArrayDictionary = (options?: Options): CompositionWithOneOfAndSimpleArrayDictionary => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([f.datatype.boolean(), !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.helpers.multiple(() => f.datatype.boolean())
+ }]) }
+ };
+};
+
+export const fakeCompositionWithOneOfAndComplexArrayDictionary = (options?: Options): CompositionWithOneOfAndComplexArrayDictionary => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([f.datatype.boolean(), !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.helpers.multiple(() => f.helpers.arrayElement([f.number.float(), f.string.sample()]))
+ }]) }
+ };
+};
+
+export const fakeCompositionWithAllOfAndNullable = (options?: Options): CompositionWithAllOfAndNullable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.datatype.boolean() ? Object.assign({}, {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { boolean: f.datatype.boolean() }
+ }, fakeModelWithEnum(options), fakeModelWithArray(options), fakeModelWithDictionary(options)) : null }
+ };
+};
+
+export const fakeCompositionWithAnyOfAndNullable = (options?: Options): CompositionWithAnyOfAndNullable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: f.helpers.arrayElement([
+ {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { boolean: f.datatype.boolean() }
+ },
+ fakeModelWithEnum(options),
+ fakeModelWithArray(options),
+ fakeModelWithDictionary(options),
+ null
+ ]) }
+ };
+};
+
+export const fakeCompositionBaseModel = (options?: Options): CompositionBaseModel => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { firstName: f.person.firstName() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { lastname: f.person.lastName() }
+ };
+};
+
+export const fakeCompositionExtendedModel = (options?: Options): CompositionExtendedModel => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakeCompositionBaseModel(options), {
+ age: f.number.int({ max: 120, min: 1 }),
+ firstName: f.person.firstName(),
+ lastname: f.person.lastName()
+ });
+};
+
+export const fakeModelWithProperties = (options?: Options): ModelWithProperties => {
+ const f = options?.faker ?? faker;
+ return {
+ required: f.string.sample(),
+ requiredAndReadOnly: f.string.sample(),
+ requiredAndNullable: f.datatype.boolean() ? f.string.sample() : null,
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { string: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { number: f.number.float() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { boolean: f.datatype.boolean() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { reference: fakeModelWithString(options) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'property with space': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { default: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { try: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { '@namespace.string': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { '@namespace.integer': f.number.int() }
+ };
+};
+
+export const fakeModelWithReference = (options?: Options): ModelWithReference => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: fakeModelWithProperties(options) }
+ };
+};
+
+export const fakeModelWithNestedProperties = (options?: Options): ModelWithNestedProperties => {
+ const f = options?.faker ?? faker;
+ return {
+ first: f.datatype.boolean() ? {
+ second: f.datatype.boolean() ? {
+ third: f.datatype.boolean() ? f.string.sample() : null
+ } : null
+ } : null
+ };
+};
+
+export const fakeModelWithDuplicateProperties = (options?: Options): ModelWithDuplicateProperties => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: fakeModelWithString(options) }
+ };
+};
+
+export const fakeModelWithOrderedProperties = (options?: Options): ModelWithOrderedProperties => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { zebra: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { apple: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { hawaii: f.string.sample() }
+ };
+};
+
+export const fakeModelWithDuplicateImports = (options?: Options): ModelWithDuplicateImports => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propA: fakeModelWithString(options) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propB: fakeModelWithString(options) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propC: fakeModelWithString(options) }
+ };
+};
+
+export const fakeModelThatExtends = (options?: Options): ModelThatExtends => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakeModelWithString(options), {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propExtendsA: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propExtendsB: fakeModelWithString(options) }
+ });
+};
+
+export const fakeModelThatExtendsExtends = (options?: Options): ModelThatExtendsExtends => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakeModelWithString(options), fakeModelThatExtends(options), {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propExtendsC: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propExtendsD: fakeModelWithString(options) }
+ });
+};
+
+export const fakeModelWithPattern = (options?: Options): ModelWithPattern => {
+ const f = options?.faker ?? faker;
+ return {
+ key: f.helpers.fromRegExp('^[a-zA-Z0-9_]*$'),
+ name: f.string.alpha({ length: { min: 0, max: 255 } }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { enabled: f.datatype.boolean() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { modified: f.date.recent().toISOString() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { id: f.helpers.fromRegExp('^\\d{2}-\\d{3}-\\d{4}$') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { text: f.helpers.fromRegExp('^\\w+$') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { patternWithSingleQuotes: f.helpers.fromRegExp('^[a-zA-Z0-9\']*$') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { patternWithNewline: f.helpers.fromRegExp('aaa\\nbbb') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { patternWithBacktick: f.helpers.fromRegExp('aaa`bbb') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { patternWithUnicode: f.helpers.fromRegExp('^\\p{L}+$') }
+ };
+};
+
+export const fakeFile = (options?: Options): File => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { id: f.string.uuid() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { updated_at: f.date.recent().toISOString() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { created_at: f.date.recent().toISOString() },
+ mime: f.string.alpha({ length: { min: 1, max: 24 } }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { file: f.internet.url() }
+ };
+};
+
+export const fakeDefault = (options?: Options): Default => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { name: f.string.sample() }
+ };
+};
+
+export const fakePageable = (options?: Options): Pageable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { page: resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int({ min: 0 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { size: f.number.int({ min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { sort: f.helpers.multiple(() => f.string.sample()) }
+ };
+};
+
+export const fakeFreeFormObjectWithoutAdditionalProperties = (): FreeFormObjectWithoutAdditionalProperties => ({});
+
+export const fakeFreeFormObjectWithAdditionalPropertiesEqTrue = (): FreeFormObjectWithAdditionalPropertiesEqTrue => ({});
+
+export const fakeFreeFormObjectWithAdditionalPropertiesEqEmptyObject = (): FreeFormObjectWithAdditionalPropertiesEqEmptyObject => ({});
+
+export const fakeModelWithConst = (options?: Options): ModelWithConst => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { String: 'String' },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { number: 0 },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { null: null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { withType: 'Some string' }
+ };
+};
+
+export const fakeModelWithAdditionalPropertiesEqTrue = (options?: Options): ModelWithAdditionalPropertiesEqTrue => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.string.sample() }
+ };
+};
+
+export const fakeNestedAnyOfArraysNullable = (options?: Options): NestedAnyOfArraysNullable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { nullableArray: f.datatype.boolean() ? f.helpers.multiple(() => f.helpers.arrayElement([f.string.sample(), f.datatype.boolean()])) : null }
+ };
+};
+
+export const fakeNullableObject = (options?: Options): NullableObject => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo: f.string.sample() }
+ } : null;
+};
+
+export const fakeCharactersInDescription = (options?: Options): CharactersInDescription => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeModelWithNullableObject = (options?: Options): ModelWithNullableObject => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { data: fakeNullableObject(options) }
+ };
+};
+
+export const fakeModelWithAdditionalPropertiesRef = (options?: Options): ModelWithAdditionalPropertiesRef => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.datatype.boolean() ? fakeNullableObject(options) : null
+ };
+};
+
+export const fakeModelWithOneOfEnum = (options?: Options): ModelWithOneOfEnum => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ {
+ foo: 'Bar'
+ },
+ {
+ foo: 'Baz'
+ },
+ {
+ foo: 'Qux'
+ },
+ {
+ content: f.date.recent().toISOString(),
+ foo: 'Quux'
+ },
+ {
+ content: [f.date.recent().toISOString(), f.string.sample()],
+ foo: 'Corge'
+ }
+ ]);
+};
+
+export const fakeModelWithNestedArrayEnumsDataFoo = (options?: Options): ModelWithNestedArrayEnumsDataFoo => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement(['foo', 'bar']);
+};
+
+export const fakeModelWithNestedArrayEnumsDataBar = (options?: Options): ModelWithNestedArrayEnumsDataBar => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement(['baz', 'qux']);
+};
+
+export const fakeModelWithNestedArrayEnumsData = (options?: Options): ModelWithNestedArrayEnumsData => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo: f.helpers.multiple(() => fakeModelWithNestedArrayEnumsDataFoo(options)) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bar: f.helpers.multiple(() => fakeModelWithNestedArrayEnumsDataBar(options)) }
+ };
+};
+
+export const fakeModelWithNestedArrayEnums = (options?: Options): ModelWithNestedArrayEnums => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { array_strings: f.helpers.multiple(() => f.string.sample()) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { data: fakeModelWithNestedArrayEnumsData(options) }
+ };
+};
+
+export const fakeModelWithNestedCompositionEnums = (options?: Options): ModelWithNestedCompositionEnums => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo: fakeModelWithNestedArrayEnumsDataFoo(options) }
+ };
+};
+
+export const fakeModelWithReadOnlyAndWriteOnly = (options?: Options): ModelWithReadOnlyAndWriteOnly => {
+ const f = options?.faker ?? faker;
+ return {
+ foo: f.string.sample(),
+ bar: f.string.sample()
+ };
+};
+
+export const fakeModelWithArrayReadOnlyAndWriteOnly = (options?: Options): ModelWithArrayReadOnlyAndWriteOnly => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.helpers.multiple(() => fakeModelWithReadOnlyAndWriteOnly(options)) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propWithFile: f.helpers.multiple(() => new Blob([f.image.dataUri()])) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propWithNumber: f.helpers.multiple(() => f.number.float()) }
+ };
+};
+
+export const fakeModelWithConstantSizeArray = (options?: Options): ModelWithConstantSizeArray => {
+ const f = options?.faker ?? faker;
+ return [f.number.float(), f.number.float()];
+};
+
+export const fakeModelWithAnyOfConstantSizeArray = (options?: Options): ModelWithAnyOfConstantSizeArray => {
+ const f = options?.faker ?? faker;
+ return [
+ f.helpers.arrayElement([f.number.float(), f.string.sample()]),
+ f.helpers.arrayElement([f.number.float(), f.string.sample()]),
+ f.helpers.arrayElement([f.number.float(), f.string.sample()])
+ ];
+};
+
+export const fakeModelWithPrefixItemsConstantSizeArray = (options?: Options): ModelWithPrefixItemsConstantSizeArray => {
+ const f = options?.faker ?? faker;
+ return [
+ fakeModelWithInteger(options),
+ f.helpers.arrayElement([f.number.float(), f.string.sample()]),
+ f.string.sample()
+ ];
+};
+
+export const fakeModelWithAnyOfConstantSizeArrayNullable = (options?: Options): ModelWithAnyOfConstantSizeArrayNullable => {
+ const f = options?.faker ?? faker;
+ return [
+ f.helpers.arrayElement([
+ f.number.float(),
+ f.string.sample(),
+ null
+ ]),
+ f.helpers.arrayElement([
+ f.number.float(),
+ f.string.sample(),
+ null
+ ]),
+ f.helpers.arrayElement([
+ f.number.float(),
+ f.string.sample(),
+ null
+ ])
+ ];
+};
+
+export const fakeModelWithNumericEnumUnion = (options?: Options): ModelWithNumericEnumUnion => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { value: f.helpers.arrayElement([
+ -10,
+ -1,
+ 0,
+ 1,
+ 3,
+ 6,
+ 12
+ ]) }
+ };
+};
+
+export const fakeModelWithBackticksInDescription = (options?: Options): ModelWithBackticksInDescription => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { template: f.string.sample() }
+ };
+};
+
+export const fakeParameterSimpleParameterUnused = (options?: Options): ParameterSimpleParameterUnused => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakePostServiceWithEmptyTagResponse = (options?: Options): PostServiceWithEmptyTagResponse => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakePostServiceWithEmptyTagResponse2 = (options?: Options): PostServiceWithEmptyTagResponse2 => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeDeleteFooData = (options?: Options): DeleteFooData => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeDeleteFooData2 = (options?: Options): DeleteFooData2 => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeImport = (options?: Options): Import => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = (options?: Options): ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions => {
+ const f = options?.faker ?? faker;
+ return [f.helpers.arrayElement([f.number.float(), fakeImport(options)]), f.helpers.arrayElement([f.number.float(), fakeImport(options)])];
+};
+
+export const fakeSchemaWithFormRestrictedKeys = (options?: Options): SchemaWithFormRestrictedKeys => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { description: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enum-descriptions': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enum-varnames': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enumNames': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { title: f.lorem.words() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { object: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { description: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enum-descriptions': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enum-varnames': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enumNames': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { title: f.lorem.words() }
+ } },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { array: f.helpers.multiple(() => ({
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { description: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enum-descriptions': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enum-varnames': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'x-enumNames': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { title: f.lorem.words() }
+ })) }
+ };
+};
+
+export const fakeIoK8sApimachineryPkgApisMetaV1Preconditions = (options?: Options): IoK8sApimachineryPkgApisMetaV1Preconditions => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { resourceVersion: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { uid: f.string.sample() }
+ };
+};
+
+export const fakeIoK8sApimachineryPkgApisMetaV1DeleteOptions = (options?: Options): IoK8sApimachineryPkgApisMetaV1DeleteOptions => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { preconditions: fakeIoK8sApimachineryPkgApisMetaV1Preconditions(options) }
+ };
+};
+
+export const fakeAdditionalPropertiesUnknownIssue = (options?: Options): AdditionalPropertiesUnknownIssue => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.helpers.arrayElement([f.string.sample(), f.number.float()])
+ };
+};
+
+export const fakeAdditionalPropertiesUnknownIssue2 = (options?: Options): AdditionalPropertiesUnknownIssue2 => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.helpers.arrayElement([f.string.sample(), f.number.float()])
+ };
+};
+
+export const fakeAdditionalPropertiesIntegerIssue = (options?: Options): AdditionalPropertiesIntegerIssue => {
+ const f = options?.faker ?? faker;
+ return {
+ value: f.number.int()
+ };
+};
+
+export const fakeGenericSchemaDuplicateIssue1SystemBoolean = (options?: Options): GenericSchemaDuplicateIssue1SystemBoolean => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { item: f.datatype.boolean() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { error: f.datatype.boolean() ? f.string.sample() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { hasError: f.datatype.boolean() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { data: {} }
+ };
+};
+
+export const fakeGenericSchemaDuplicateIssue1SystemString = (options?: Options): GenericSchemaDuplicateIssue1SystemString => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { item: f.datatype.boolean() ? f.string.sample() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { error: f.datatype.boolean() ? f.string.sample() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { hasError: f.datatype.boolean() }
+ };
+};
+
+export const fakeOneOfAllOfIssue = (options?: Options): OneOfAllOfIssue => fakeGenericSchemaDuplicateIssue1SystemString(options);
+
+export const fakeExternalSharedModel = (options?: Options): ExternalSharedModel => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { name: f.string.sample() }
+ };
+};
+
+export const fakeExternalRefA = (options?: Options): ExternalRefA => fakeExternalSharedModel(options);
+
+export const fakeExternalRefB = (options?: Options): ExternalRefB => fakeExternalSharedModel(options);
+
+export const fakeModelWithPropertiesWritable = (options?: Options): ModelWithPropertiesWritable => {
+ const f = options?.faker ?? faker;
+ return {
+ required: f.string.sample(),
+ requiredAndNullable: f.datatype.boolean() ? f.string.sample() : null,
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { string: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { number: f.number.float() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { boolean: f.datatype.boolean() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { reference: fakeModelWithString(options) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'property with space': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { default: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { try: f.string.sample() }
+ };
+};
+
+export const fakeModelWithReferenceWritable = (options?: Options): ModelWithReferenceWritable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: fakeModelWithPropertiesWritable(options) }
+ };
+};
+
+export const fakeModelWithPatternWritable = (options?: Options): ModelWithPatternWritable => {
+ const f = options?.faker ?? faker;
+ return {
+ key: f.helpers.fromRegExp('^[a-zA-Z0-9_]*$'),
+ name: f.string.alpha({ length: { min: 0, max: 255 } }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { id: f.helpers.fromRegExp('^\\d{2}-\\d{3}-\\d{4}$') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { text: f.helpers.fromRegExp('^\\w+$') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { patternWithSingleQuotes: f.helpers.fromRegExp('^[a-zA-Z0-9\']*$') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { patternWithNewline: f.helpers.fromRegExp('aaa\\nbbb') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { patternWithBacktick: f.helpers.fromRegExp('aaa`bbb') },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { patternWithUnicode: f.helpers.fromRegExp('^\\p{L}+$') }
+ };
+};
+
+export const fakeFileWritable = (options?: Options): FileWritable => {
+ const f = options?.faker ?? faker;
+ return {
+ mime: f.string.alpha({ length: { min: 1, max: 24 } })
+ };
+};
+
+export const fakeModelWithReadOnlyAndWriteOnlyWritable = (options?: Options): ModelWithReadOnlyAndWriteOnlyWritable => {
+ const f = options?.faker ?? faker;
+ return {
+ foo: f.string.sample(),
+ baz: f.string.sample()
+ };
+};
+
+export const fakeModelWithArrayReadOnlyAndWriteOnlyWritable = (options?: Options): ModelWithArrayReadOnlyAndWriteOnlyWritable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { prop: f.helpers.multiple(() => fakeModelWithReadOnlyAndWriteOnlyWritable(options)) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propWithFile: f.helpers.multiple(() => new Blob([f.image.dataUri()])) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { propWithNumber: f.helpers.multiple(() => f.number.float()) }
+ };
+};
+
+export const fakeModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = (options?: Options): ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable => {
+ const f = options?.faker ?? faker;
+ return [f.helpers.arrayElement([f.number.float(), fakeImport(options)]), f.helpers.arrayElement([f.number.float(), fakeImport(options)])];
+};
+
+export const fakeAdditionalPropertiesUnknownIssueWritable = (options?: Options): AdditionalPropertiesUnknownIssueWritable => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.helpers.arrayElement([f.string.sample(), f.number.float()])
+ };
+};
+
+export const fakeOneOfAllOfIssueWritable = (options?: Options): OneOfAllOfIssueWritable => fakeGenericSchemaDuplicateIssue1SystemString(options);
+
+export const fakeGenericSchemaDuplicateIssue1SystemBooleanWritable = (options?: Options): GenericSchemaDuplicateIssue1SystemBooleanWritable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { item: f.datatype.boolean() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { error: f.datatype.boolean() ? f.string.sample() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { data: {} }
+ };
+};
+
+export const fakeGenericSchemaDuplicateIssue1SystemStringWritable = (options?: Options): GenericSchemaDuplicateIssue1SystemStringWritable => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { item: f.datatype.boolean() ? f.string.sample() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { error: f.datatype.boolean() ? f.string.sample() : null }
+ };
+};
+
+export const fakeSimpleParameter = (options?: Options): SimpleParameter => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeCompositionWithOneOfAndProperties = (options?: Options): CompositionWithOneOfAndProperties => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, f.helpers.arrayElement([{
+ foo: fakeSimpleParameter(options)
+ }, {
+ bar: fakeNonAsciiStringæøåÆøÅöôêÊ字符串(options)
+ }]), {
+ baz: f.datatype.boolean() ? f.number.int({ min: 0 }) : null,
+ qux: f.number.int({ min: 0 })
+ });
+};
+
+export const fakeXFooBar = (options?: Options): XFooBar => fakeModelWithString(options);
+
+export const fakeSimpleRequestBody = (options?: Options): SimpleRequestBody => fakeModelWithString(options);
+
+export const fakeSimpleFormData = (options?: Options): SimpleFormData => fakeModelWithString(options);
+
+export const fakePatchApiVbyApiVersionNoTagResponse = () => undefined;
+
+export const fakeImportRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: f.helpers.arrayElement([fakeModelWithReadOnlyAndWriteOnlyWritable(options), fakeModelWithArrayReadOnlyAndWriteOnlyWritable(options)])
+ };
+};
+
+export const fakeImportResponse200 = (options?: Options): ImportResponses[200] => fakeModelFromZendesk(options);
+
+export const fakeImportResponsedefault = (options?: Options): ImportResponses['default'] => fakeModelWithReadOnlyAndWriteOnly(options);
+
+export const fakeFooWowResponse = () => undefined;
+
+export const fakeApiVVersionODataControllerCountResponse = (options?: Options): ApiVVersionODataControllerCountResponse => fakeModelFromZendesk(options);
+
+export const fakeGetApiVbyApiVersionSimpleOperationRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ foo_param: f.helpers.arrayElement([f.string.sample(), f.string.uuid()])
+ }
+ };
+};
+
+export const fakeGetApiVbyApiVersionSimpleOperationResponse200 = (options?: Options): GetApiVbyApiVersionSimpleOperationResponses[200] => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeGetApiVbyApiVersionSimpleOperationResponsedefault = (options?: Options): GetApiVbyApiVersionSimpleOperationErrors['default'] => fakeModelWithBoolean(options);
+
+export const fakeDeleteFooRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ headers: {
+ 'x-Foo-Bar': fakeModelWithString(options)
+ },
+ path: {
+ foo_param: f.string.sample(),
+ BarParam: f.string.sample()
+ }
+ };
+};
+
+export const fakeCallWithDescriptionsRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterWithBreaks: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterWithBackticks: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterWithSlashes: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterWithExpressionPlaceholders: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterWithQuotes: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterWithReservedCharacters: f.string.sample() }
+ }
+ };
+};
+
+export const fakeDeprecatedCallRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ headers: {
+ parameter: f.datatype.boolean() ? fakeDeprecatedModel(options) : null
+ }
+ };
+};
+
+export const fakeCallWithParametersRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: f.datatype.boolean() ? {} : null,
+ headers: {
+ parameterHeader: f.datatype.boolean() ? f.string.sample() : null
+ },
+ path: {
+ parameterPath: f.datatype.boolean() ? f.string.sample() : null,
+ 'api-version': f.datatype.boolean() ? f.string.sample() : null
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo_ref_enum: fakeModelWithNestedArrayEnumsDataFoo(options) },
+ foo_all_of_enum: fakeModelWithNestedArrayEnumsDataFoo(options),
+ cursor: f.datatype.boolean() ? f.string.sample() : null
+ }
+ };
+};
+
+export const fakeCallWithWeirdParameterNamesRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: f.datatype.boolean() ? fakeModelWithString(options) : null,
+ headers: {
+ 'parameter.header': f.datatype.boolean() ? f.string.sample() : null
+ },
+ path: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'parameter.path.1': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'parameter-path-2': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { 'PARAMETER-PATH-3': f.string.sample() },
+ 'api-version': f.datatype.boolean() ? f.string.sample() : null
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { default: f.string.sample() },
+ 'parameter-query': f.datatype.boolean() ? f.string.sample() : null
+ }
+ };
+};
+
+export const fakeGetCallWithOptionalParamRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: fakeModelWithOneOfEnum(options),
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { page: f.number.float() }
+ }
+ };
+};
+
+export const fakePostCallWithOptionalParamRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { offset: f.datatype.boolean() ? f.number.float() : null }
+ },
+ query: {
+ parameter: fakePageable(options)
+ }
+ };
+};
+
+export const fakePostCallWithOptionalParamResponse = (options?: Options): PostCallWithOptionalParamResponse => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakePostApiVbyApiVersionRequestBodyRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: fakeSimpleRequestBody(options),
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameter: f.string.sample() }
+ }
+ };
+};
+
+export const fakePostApiVbyApiVersionFormDataRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: fakeSimpleFormData(options),
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameter: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCallWithDefaultParametersRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterString: f.datatype.boolean() ? resolveCondition(options?.useDefault ?? false, f) ? 'Hello World!' : f.string.sample() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterNumber: f.datatype.boolean() ? resolveCondition(options?.useDefault ?? false, f) ? 123 : f.number.float() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterBoolean: f.datatype.boolean() ? resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterEnum: f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error'
+ ]) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterModel: f.datatype.boolean() ? fakeModelWithString(options) : null }
+ }
+ };
+};
+
+export const fakeCallWithDefaultOptionalParametersRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterString: resolveCondition(options?.useDefault ?? false, f) ? 'Hello World!' : f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterNumber: resolveCondition(options?.useDefault ?? false, f) ? 123 : f.number.float() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterBoolean: resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterEnum: f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error'
+ ]) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterModel: fakeModelWithString(options) }
+ }
+ };
+};
+
+export const fakeCallToTestOrderOfParamsRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterOptionalStringWithDefault: resolveCondition(options?.useDefault ?? false, f) ? 'Hello World!' : f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterOptionalStringWithEmptyDefault: resolveCondition(options?.useDefault ?? false, f) ? '' : f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterOptionalStringWithNoDefault: f.string.sample() },
+ parameterStringWithDefault: resolveCondition(options?.useDefault ?? false, f) ? 'Hello World!' : f.string.sample(),
+ parameterStringWithEmptyDefault: resolveCondition(options?.useDefault ?? false, f) ? '' : f.string.sample(),
+ parameterStringWithNoDefault: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterStringNullableWithNoDefault: f.datatype.boolean() ? f.string.sample() : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { parameterStringNullableWithDefault: f.datatype.boolean() ? f.string.sample() : null }
+ }
+ };
+};
+
+export const fakeCallWithResponseAndNoContentResponseResponse = (options?: Options): CallWithResponseAndNoContentResponseResponse => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeDummyAResponse = (options?: Options): DummyAResponse => fake400(options);
+
+export const fakeCallWithResponseResponse = (options?: Options): CallWithResponseResponse => fakeImport(options);
+
+export const fakeCallWithDuplicateResponsesResponse200 = (options?: Options): CallWithDuplicateResponsesResponses[200] => Object.assign({}, fakeModelWithBoolean(options), fakeModelWithInteger(options));
+
+export const fakeCallWithDuplicateResponsesResponse201 = (options?: Options): CallWithDuplicateResponsesResponses[201] => fakeModelWithString(options);
+
+export const fakeCallWithDuplicateResponsesResponse202 = (options?: Options): CallWithDuplicateResponsesResponses[202] => fakeModelWithString(options);
+
+export const fakeCallWithDuplicateResponsesResponse500 = (options?: Options): CallWithDuplicateResponsesErrors[500] => fakeModelWithStringError(options);
+
+export const fakeCallWithDuplicateResponsesResponse501 = (options?: Options): CallWithDuplicateResponsesErrors[501] => fakeModelWithStringError(options);
+
+export const fakeCallWithDuplicateResponsesResponse502 = (options?: Options): CallWithDuplicateResponsesErrors[502] => fakeModelWithStringError(options);
+
+export const fakeCallWithDuplicateResponsesResponse4Xx = (options?: Options): CallWithDuplicateResponsesErrors['4XX'] => fakeDictionaryWithArray(options);
+
+export const fakeCallWithDuplicateResponsesResponsedefault = (options?: Options): CallWithDuplicateResponsesErrors['default'] => fakeModelWithBoolean(options);
+
+export const fakeCallWithResponsesResponse200 = (options?: Options): CallWithResponsesResponses[200] => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { '@namespace.string': f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { '@namespace.integer': f.number.int() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { value: f.helpers.multiple(() => fakeModelWithString(options)) }
+ };
+};
+
+export const fakeCallWithResponsesResponse201 = (options?: Options): CallWithResponsesResponses[201] => fakeModelThatExtends(options);
+
+export const fakeCallWithResponsesResponse202 = (options?: Options): CallWithResponsesResponses[202] => fakeModelThatExtendsExtends(options);
+
+export const fakeCallWithResponsesResponse500 = (options?: Options): CallWithResponsesErrors[500] => fakeModelWithStringError(options);
+
+export const fakeCallWithResponsesResponse501 = (options?: Options): CallWithResponsesErrors[501] => fakeModelWithStringError(options);
+
+export const fakeCallWithResponsesResponse502 = (options?: Options): CallWithResponsesErrors[502] => fakeModelWithStringError(options);
+
+export const fakeCallWithResponsesResponsedefault = (options?: Options): CallWithResponsesErrors['default'] => fakeModelWithStringError(options);
+
+export const fakeCollectionFormatRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ parameterArrayCSV: f.datatype.boolean() ? f.helpers.multiple(() => f.string.sample()) : null,
+ parameterArraySSV: f.datatype.boolean() ? f.helpers.multiple(() => f.string.sample()) : null,
+ parameterArrayTSV: f.datatype.boolean() ? f.helpers.multiple(() => f.string.sample()) : null,
+ parameterArrayPipes: f.datatype.boolean() ? f.helpers.multiple(() => f.string.sample()) : null,
+ parameterArrayMulti: f.datatype.boolean() ? f.helpers.multiple(() => f.string.sample()) : null
+ }
+ };
+};
+
+export const fakeTypesRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { id: f.number.int() }
+ },
+ query: {
+ parameterNumber: resolveCondition(options?.useDefault ?? false, f) ? 123 : f.number.float(),
+ parameterString: f.datatype.boolean() ? resolveCondition(options?.useDefault ?? false, f) ? 'default' : f.string.sample() : null,
+ parameterBoolean: f.datatype.boolean() ? resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean() : null,
+ parameterObject: f.datatype.boolean() ? {} : null,
+ parameterArray: f.datatype.boolean() ? f.helpers.multiple(() => f.string.sample()) : null,
+ parameterDictionary: f.datatype.boolean() ? {} : null,
+ parameterEnum: f.helpers.arrayElement([
+ 'Success',
+ 'Warning',
+ 'Error',
+ null
+ ])
+ }
+ };
+};
+
+export const fakeTypesResponse200 = (options?: Options): TypesResponses[200] => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeTypesResponse201 = (options?: Options): TypesResponses[201] => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
+
+export const fakeTypesResponse202 = (options?: Options): TypesResponses[202] => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeTypesResponse203 = (): TypesResponses[203] => ({});
+
+export const fakeUploadFileRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: new Blob([f.image.dataUri()]),
+ path: {
+ 'api-version': f.datatype.boolean() ? f.string.sample() : null
+ }
+ };
+};
+
+export const fakeUploadFileResponse = (options?: Options): UploadFileResponse => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeFileResponseRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid(),
+ 'api-version': f.string.sample()
+ }
+ };
+};
+
+export const fakeFileResponseResponse = (options?: Options): FileResponseResponse => {
+ const f = options?.faker ?? faker;
+ return new Blob([f.image.dataUri()]);
+};
+
+export const fakeComplexTypesRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ parameterObject: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { first: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { second: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { third: f.string.sample() }
+ } }
+ } }
+ },
+ parameterReference: fakeModelWithString(options)
+ }
+ };
+};
+
+export const fakeComplexTypesResponse200 = (options?: Options): ComplexTypesResponses[200] => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakeModelWithString(options));
+};
+
+export const fakeComplexTypesResponse400 = (): ComplexTypesErrors[400] => undefined;
+
+export const fakeComplexTypesResponse500 = (): ComplexTypesErrors[500] => undefined;
+
+export const fakeMultipartResponseResponse = (options?: Options): MultipartResponseResponse => {
+ const f = options?.faker ?? faker;
+ return {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { file: new Blob([f.image.dataUri()]) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { metadata: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { foo: f.string.sample() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bar: f.string.sample() }
+ } }
+ };
+};
+
+export const fakeMultipartRequestRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { content: new Blob([f.image.dataUri()]) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { data: f.datatype.boolean() ? fakeModelWithString(options) : null }
+ }
+ };
+};
+
+export const fakeComplexParamsRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ key: f.datatype.boolean() ? f.helpers.fromRegExp('^[a-zA-Z0-9_]*$') : null,
+ name: f.datatype.boolean() ? f.string.alpha({ length: { min: 0, max: 255 } }) : null,
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { enabled: resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean() },
+ type: f.helpers.arrayElement([
+ 'Monkey',
+ 'Horse',
+ 'Bird'
+ ]),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { listOfModels: f.datatype.boolean() ? f.helpers.multiple(() => fakeModelWithString(options)) : null },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { listOfStrings: f.datatype.boolean() ? f.helpers.multiple(() => f.string.sample()) : null },
+ parameters: f.helpers.arrayElement([
+ fakeModelWithString(options),
+ fakeModelWithEnum(options),
+ fakeModelWithArray(options),
+ fakeModelWithDictionary(options)
+ ]),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { user: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { id: f.number.int() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { name: f.datatype.boolean() ? f.person.fullName() : null }
+ } }
+ },
+ path: {
+ id: f.number.int(),
+ 'api-version': f.string.sample()
+ }
+ };
+};
+
+export const fakeComplexParamsResponse = (options?: Options): ComplexParamsResponse => fakeModelWithString(options);
+
+export const fakeCallWithResultFromHeaderResponse200 = (): CallWithResultFromHeaderResponses[200] => undefined;
+
+export const fakeCallWithResultFromHeaderResponse400 = (): CallWithResultFromHeaderErrors[400] => undefined;
+
+export const fakeCallWithResultFromHeaderResponse500 = (): CallWithResultFromHeaderErrors[500] => undefined;
+
+export const fakeTestErrorCodeRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ status: f.number.int()
+ }
+ };
+};
+
+export const fakeTestErrorCodeResponse200 = (): TestErrorCodeResponses[200] => undefined;
+
+export const fakeTestErrorCodeResponse500 = (): TestErrorCodeErrors[500] => undefined;
+
+export const fakeTestErrorCodeResponse501 = (): TestErrorCodeErrors[501] => undefined;
+
+export const fakeTestErrorCodeResponse502 = (): TestErrorCodeErrors[502] => undefined;
+
+export const fakeTestErrorCodeResponse503 = (): TestErrorCodeErrors[503] => undefined;
+
+export const fakeNonAsciiæøåÆøÅöôêÊ字符串Request = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ nonAsciiParamæøåÆØÅöôêÊ: f.number.int()
+ }
+ };
+};
+
+export const fakeNonAsciiæøåÆøÅöôêÊ字符串Response = (options?: Options): NonAsciiæøåÆøÅöôêÊ字符串Response => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakeNonAsciiStringæøåÆøÅöôêÊ字符串(options));
+};
+
+export const fakePutWithFormUrlEncodedRequest = (options?: Options): Omit => ({
+ body: fakeArrayWithStrings(options)
+});
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/index.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/index.ts
new file mode 100644
index 0000000000..2ef59c1f0c
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/index.ts
@@ -0,0 +1,3 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAdditionalPropertiesRef, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen';
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/types.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/types.gen.ts
new file mode 100644
index 0000000000..d819316644
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-full/types.gen.ts
@@ -0,0 +1,2100 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type ClientOptions = {
+ baseUrl: 'http://localhost:3000/base' | (string & {});
+};
+
+/**
+ * Model with number-only name
+ */
+export type _400 = string;
+
+/**
+ * External ref to shared model (A)
+ */
+export type ExternalRefA = ExternalSharedModel;
+
+/**
+ * External ref to shared model (B)
+ */
+export type ExternalRefB = ExternalSharedModel;
+
+/**
+ * Testing multiline comments in string: First line
+ * Second line
+ *
+ * Fourth line
+ */
+export type CamelCaseCommentWithBreaks = number;
+
+/**
+ * Testing multiline comments in string: First line
+ * Second line
+ *
+ * Fourth line
+ */
+export type CommentWithBreaks = number;
+
+/**
+ * Testing backticks in string: `backticks` and ```multiple backticks``` should work
+ */
+export type CommentWithBackticks = number;
+
+/**
+ * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work
+ */
+export type CommentWithBackticksAndQuotes = number;
+
+/**
+ * Testing slashes in string: \backwards\\\ and /forwards/// should work
+ */
+export type CommentWithSlashes = number;
+
+/**
+ * Testing expression placeholders in string: ${expression} should work
+ */
+export type CommentWithExpressionPlaceholders = number;
+
+/**
+ * Testing quotes in string: 'single quote''' and "double quotes""" should work
+ */
+export type CommentWithQuotes = number;
+
+/**
+ * Testing reserved characters in string: * inline * and ** inline ** should work
+ */
+export type CommentWithReservedCharacters = number;
+
+/**
+ * This is a simple number
+ */
+export type SimpleInteger = number;
+
+/**
+ * This is a simple boolean
+ */
+export type SimpleBoolean = boolean;
+
+/**
+ * This is a simple string
+ */
+export type SimpleString = string;
+
+/**
+ * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串)
+ */
+export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string;
+
+/**
+ * This is a simple file
+ */
+export type SimpleFile = Blob | File;
+
+/**
+ * This is a simple reference
+ */
+export type SimpleReference = ModelWithString;
+
+/**
+ * This is a simple string
+ */
+export type SimpleStringWithPattern = string | null;
+
+/**
+ * This is a simple enum with strings
+ */
+export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串';
+
+export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | '';
+
+/**
+ * This is a simple enum with numbers
+ */
+export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3;
+
+/**
+ * Success=1,Warning=2,Error=3
+ */
+export type EnumFromDescription = number;
+
+/**
+ * This is a simple enum with numbers
+ */
+export type EnumWithExtensions = 200 | 400 | 500;
+
+export type EnumWithXEnumNames = 0 | 1 | 2;
+
+/**
+ * This is a simple array with numbers
+ */
+export type ArrayWithNumbers = Array;
+
+/**
+ * This is a simple array with booleans
+ */
+export type ArrayWithBooleans = Array;
+
+/**
+ * This is a simple array with strings
+ */
+export type ArrayWithStrings = Array;
+
+/**
+ * This is a simple array with references
+ */
+export type ArrayWithReferences = Array;
+
+/**
+ * This is a simple array containing an array
+ */
+export type ArrayWithArray = Array>;
+
+/**
+ * This is a simple array with properties
+ */
+export type ArrayWithProperties = Array<{
+ '16x16'?: CamelCaseCommentWithBreaks;
+ bar?: string;
+}>;
+
+/**
+ * This is a simple array with any of properties
+ */
+export type ArrayWithAnyOfProperties = Array<{
+ foo?: string;
+} | {
+ bar?: string;
+}>;
+
+export type AnyOfAnyAndNull = {
+ data?: unknown | null;
+};
+
+/**
+ * This is a simple array with any of properties
+ */
+export type AnyOfArrays = {
+ results?: Array<{
+ foo?: string;
+ } | {
+ bar?: string;
+ }>;
+};
+
+/**
+ * This is a string dictionary
+ */
+export type DictionaryWithString = {
+ [key: string]: string;
+};
+
+export type DictionaryWithPropertiesAndAdditionalProperties = {
+ foo?: number;
+ bar?: boolean;
+ [key: string]: string | number | boolean | undefined;
+};
+
+/**
+ * This is a string reference
+ */
+export type DictionaryWithReference = {
+ [key: string]: ModelWithString;
+};
+
+/**
+ * This is a complex dictionary
+ */
+export type DictionaryWithArray = {
+ [key: string]: Array;
+};
+
+/**
+ * This is a string dictionary
+ */
+export type DictionaryWithDictionary = {
+ [key: string]: {
+ [key: string]: string;
+ };
+};
+
+/**
+ * This is a complex dictionary
+ */
+export type DictionaryWithProperties = {
+ [key: string]: {
+ foo?: string;
+ bar?: string;
+ };
+};
+
+/**
+ * This is a model with one number property
+ */
+export type ModelWithInteger = {
+ /**
+ * This is a simple number property
+ */
+ prop?: number;
+};
+
+/**
+ * This is a model with one boolean property
+ */
+export type ModelWithBoolean = {
+ /**
+ * This is a simple boolean property
+ */
+ prop?: boolean;
+};
+
+/**
+ * This is a model with one string property
+ */
+export type ModelWithString = {
+ /**
+ * This is a simple string property
+ */
+ 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)
+ */
+export type ModelFromZendesk = string;
+
+/**
+ * This is a model with one string property
+ */
+export type ModelWithNullableString = {
+ /**
+ * This is a simple string property
+ */
+ nullableProp1?: string | null;
+ /**
+ * This is a simple string property
+ */
+ nullableRequiredProp1: string | null;
+ /**
+ * This is a simple string property
+ */
+ nullableProp2?: string | null;
+ /**
+ * This is a simple string property
+ */
+ nullableRequiredProp2: string | null;
+ /**
+ * This is a simple enum with strings
+ */
+ 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串';
+};
+
+/**
+ * This is a model with one enum
+ */
+export type ModelWithEnum = {
+ /**
+ * This is a simple enum with strings
+ */
+ 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串';
+ /**
+ * These are the HTTP error code enums
+ */
+ statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar';
+ /**
+ * Simple boolean enum
+ */
+ bool?: true;
+};
+
+/**
+ * This is a model with one enum with escaped name
+ */
+export type ModelWithEnumWithHyphen = {
+ /**
+ * Foo-Bar-Baz-Qux
+ */
+ 'foo-bar-baz-qux'?: '3.0';
+};
+
+/**
+ * This is a model with one enum
+ */
+export type ModelWithEnumFromDescription = {
+ /**
+ * Success=1,Warning=2,Error=3
+ */
+ test?: number;
+};
+
+/**
+ * This is a model with nested enums
+ */
+export type ModelWithNestedEnums = {
+ dictionaryWithEnum?: {
+ [key: string]: 'Success' | 'Warning' | 'Error';
+ };
+ dictionaryWithEnumFromDescription?: {
+ [key: string]: number;
+ };
+ arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>;
+ arrayWithDescription?: Array;
+ /**
+ * This is a simple enum with strings
+ */
+ 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串';
+};
+
+/**
+ * This is a model with one property containing a reference
+ */
+export type ModelWithReference = {
+ prop?: ModelWithProperties;
+};
+
+/**
+ * This is a model with one property containing an array
+ */
+export type ModelWithArrayReadOnlyAndWriteOnly = {
+ prop?: Array;
+ propWithFile?: Array;
+ propWithNumber?: Array;
+};
+
+/**
+ * This is a model with one property containing an array
+ */
+export type ModelWithArray = {
+ prop?: Array;
+ propWithFile?: Array;
+ propWithNumber?: Array;
+};
+
+/**
+ * This is a model with one property containing a dictionary
+ */
+export type ModelWithDictionary = {
+ prop?: {
+ [key: string]: string;
+ };
+};
+
+/**
+ * This is a deprecated model with a deprecated property
+ *
+ * @deprecated
+ */
+export type DeprecatedModel = {
+ /**
+ * This is a deprecated property
+ *
+ * @deprecated
+ */
+ prop?: string;
+};
+
+/**
+ * This is a model with one property containing a circular reference
+ */
+export type ModelWithCircularReference = {
+ prop?: ModelWithCircularReference;
+};
+
+/**
+ * This is a model with one property with a 'one of' relationship
+ */
+export type CompositionWithOneOf = {
+ propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary;
+};
+
+/**
+ * This is a model with one property with a 'one of' relationship where the options are not $ref
+ */
+export type CompositionWithOneOfAnonymous = {
+ propA?: {
+ propA?: string;
+ } | string | number;
+};
+
+/**
+ * Circle
+ */
+export type ModelCircle = {
+ kind: string;
+ radius?: number;
+};
+
+/**
+ * Square
+ */
+export type ModelSquare = {
+ kind: string;
+ sideLength?: number;
+};
+
+/**
+ * This is a model with one property with a 'one of' relationship where the options are not $ref
+ */
+export type CompositionWithOneOfDiscriminator = ({
+ kind: 'circle';
+} & ModelCircle) | ({
+ kind: 'square';
+} & ModelSquare);
+
+/**
+ * This is a model with one property with a 'any of' relationship
+ */
+export type CompositionWithAnyOf = {
+ propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary;
+};
+
+/**
+ * This is a model with one property with a 'any of' relationship where the options are not $ref
+ */
+export type CompositionWithAnyOfAnonymous = {
+ propA?: {
+ propA?: string;
+ } | string | number;
+};
+
+/**
+ * This is a model with nested 'any of' property with a type null
+ */
+export type CompositionWithNestedAnyAndTypeNull = {
+ propA?: Array | Array;
+};
+
+export type _3eNum1Период = 'Bird' | 'Dog';
+
+export type ConstValue = 'ConstValue';
+
+/**
+ * This is a model with one property with a 'any of' relationship where the options are not $ref
+ */
+export type CompositionWithNestedAnyOfAndNull = {
+ /**
+ * Scopes
+ */
+ propA?: Array<_3eNum1Период | ConstValue> | null;
+};
+
+/**
+ * This is a model with one property with a 'one of' relationship
+ */
+export type CompositionWithOneOfAndNullable = {
+ propA?: {
+ boolean?: boolean;
+ } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null;
+};
+
+/**
+ * This is a model that contains a simple dictionary within composition
+ */
+export type CompositionWithOneOfAndSimpleDictionary = {
+ propA?: boolean | {
+ [key: string]: number;
+ };
+};
+
+/**
+ * This is a model that contains a dictionary of simple arrays within composition
+ */
+export type CompositionWithOneOfAndSimpleArrayDictionary = {
+ propA?: boolean | {
+ [key: string]: Array;
+ };
+};
+
+/**
+ * This is a model that contains a dictionary of complex arrays (composited) within composition
+ */
+export type CompositionWithOneOfAndComplexArrayDictionary = {
+ propA?: boolean | {
+ [key: string]: Array;
+ };
+};
+
+/**
+ * This is a model with one property with a 'all of' relationship
+ */
+export type CompositionWithAllOfAndNullable = {
+ propA?: ({
+ boolean?: boolean;
+ } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null;
+};
+
+/**
+ * This is a model with one property with a 'any of' relationship
+ */
+export type CompositionWithAnyOfAndNullable = {
+ propA?: {
+ boolean?: boolean;
+ } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null;
+};
+
+/**
+ * This is a base model with two simple optional properties
+ */
+export type CompositionBaseModel = {
+ firstName?: string;
+ lastname?: string;
+};
+
+/**
+ * This is a model that extends the base model
+ */
+export type CompositionExtendedModel = CompositionBaseModel & {
+ age: number;
+ firstName: string;
+ lastname: string;
+};
+
+/**
+ * This is a model with one nested property
+ */
+export type ModelWithProperties = {
+ required: string;
+ readonly requiredAndReadOnly: string;
+ requiredAndNullable: string | null;
+ string?: string;
+ number?: number;
+ boolean?: boolean;
+ reference?: ModelWithString;
+ 'property with space'?: string;
+ default?: string;
+ try?: string;
+ readonly '@namespace.string'?: string;
+ readonly '@namespace.integer'?: number;
+};
+
+/**
+ * This is a model with one nested property
+ */
+export type ModelWithNestedProperties = {
+ readonly first: {
+ readonly second: {
+ readonly third: string | null;
+ } | null;
+ } | null;
+};
+
+/**
+ * This is a model with duplicated properties
+ */
+export type ModelWithDuplicateProperties = {
+ prop?: ModelWithString;
+};
+
+/**
+ * This is a model with ordered properties
+ */
+export type ModelWithOrderedProperties = {
+ zebra?: string;
+ apple?: string;
+ hawaii?: string;
+};
+
+/**
+ * This is a model with duplicated imports
+ */
+export type ModelWithDuplicateImports = {
+ propA?: ModelWithString;
+ propB?: ModelWithString;
+ propC?: ModelWithString;
+};
+
+/**
+ * This is a model that extends another model
+ */
+export type ModelThatExtends = ModelWithString & {
+ propExtendsA?: string;
+ propExtendsB?: ModelWithString;
+};
+
+/**
+ * This is a model that extends another model
+ */
+export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & {
+ propExtendsC?: string;
+ propExtendsD?: ModelWithString;
+};
+
+/**
+ * This is a model that contains a some patterns
+ */
+export type ModelWithPattern = {
+ key: string;
+ name: string;
+ readonly enabled?: boolean;
+ readonly modified?: string;
+ id?: string;
+ text?: string;
+ patternWithSingleQuotes?: string;
+ patternWithNewline?: string;
+ patternWithBacktick?: string;
+ patternWithUnicode?: string;
+};
+
+export type File = {
+ /**
+ * Id
+ */
+ readonly id?: string;
+ /**
+ * Updated at
+ */
+ readonly updated_at?: string;
+ /**
+ * Created at
+ */
+ readonly created_at?: string;
+ /**
+ * Mime
+ */
+ mime: string;
+ /**
+ * File
+ */
+ readonly file?: string;
+};
+
+export type Default = {
+ name?: string;
+};
+
+export type Pageable = {
+ page?: number;
+ size?: number;
+ sort?: Array;
+};
+
+/**
+ * This is a free-form object without additionalProperties.
+ */
+export type FreeFormObjectWithoutAdditionalProperties = {
+ [key: string]: unknown;
+};
+
+/**
+ * This is a free-form object with additionalProperties: true.
+ */
+export type FreeFormObjectWithAdditionalPropertiesEqTrue = {
+ [key: string]: unknown;
+};
+
+/**
+ * This is a free-form object with additionalProperties: {}.
+ */
+export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = {
+ [key: string]: unknown;
+};
+
+export type ModelWithConst = {
+ String?: 'String';
+ number?: 0;
+ null?: null;
+ withType?: 'Some string';
+};
+
+/**
+ * This is a model with one property and additionalProperties: true
+ */
+export type ModelWithAdditionalPropertiesEqTrue = {
+ /**
+ * This is a simple string property
+ */
+ prop?: string;
+ [key: string]: unknown;
+};
+
+export type NestedAnyOfArraysNullable = {
+ nullableArray?: Array | null;
+};
+
+export type CompositionWithOneOfAndProperties = ({
+ foo: SimpleParameter;
+} | {
+ bar: NonAsciiStringæøåÆøÅöôêÊ字符串;
+}) & {
+ baz: number | null;
+ qux: number;
+};
+
+/**
+ * An object that can be null
+ */
+export type NullableObject = {
+ foo?: string;
+} | null;
+
+/**
+ * Some % character
+ */
+export type CharactersInDescription = string;
+
+export type ModelWithNullableObject = {
+ data?: NullableObject;
+};
+
+/**
+ * An object with additional properties that can be null (anyOf ref + null)
+ */
+export type ModelWithAdditionalPropertiesRef = {
+ [key: string]: NullableObject | null;
+};
+
+export type ModelWithOneOfEnum = {
+ foo: 'Bar';
+} | {
+ foo: 'Baz';
+} | {
+ foo: 'Qux';
+} | {
+ content: string;
+ foo: 'Quux';
+} | {
+ content: [
+ string,
+ string
+ ];
+ foo: 'Corge';
+};
+
+export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar';
+
+export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux';
+
+export type ModelWithNestedArrayEnumsData = {
+ foo?: Array;
+ bar?: Array;
+};
+
+export type ModelWithNestedArrayEnums = {
+ array_strings?: Array;
+ data?: ModelWithNestedArrayEnumsData;
+};
+
+export type ModelWithNestedCompositionEnums = {
+ foo?: ModelWithNestedArrayEnumsDataFoo;
+};
+
+export type ModelWithReadOnlyAndWriteOnly = {
+ foo: string;
+ readonly bar: string;
+};
+
+export type ModelWithConstantSizeArray = [
+ number,
+ number
+];
+
+export type ModelWithAnyOfConstantSizeArray = [
+ number | string,
+ number | string,
+ number | string
+];
+
+export type ModelWithPrefixItemsConstantSizeArray = [
+ ModelWithInteger,
+ number | string,
+ string
+];
+
+export type ModelWithAnyOfConstantSizeArrayNullable = [
+ number | null | string,
+ number | null | string,
+ number | null | string
+];
+
+export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [
+ number | Import,
+ number | Import
+];
+
+export type ModelWithAnyOfConstantSizeArrayAndIntersect = [
+ number & string,
+ number & string
+];
+
+export type ModelWithNumericEnumUnion = {
+ /**
+ * Период
+ */
+ value?: -10 | -1 | 0 | 1 | 3 | 6 | 12;
+};
+
+/**
+ * Some description with `back ticks`
+ */
+export type ModelWithBackticksInDescription = {
+ /**
+ * The template `that` should be used for parsing and importing the contents of the CSV file.
+ *
+ *
There is one placeholder currently supported:
- ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)
Example of a correct JSON template:
+ *
+ * [
+ * {
+ * "resourceType": "Asset",
+ * "identifier": {
+ * "name": "${1}",
+ * "domain": {
+ * "name": "${2}",
+ * "community": {
+ * "name": "Some Community"
+ * }
+ * }
+ * },
+ * "attributes" : {
+ * "00000000-0000-0000-0000-000000003115" : [ {
+ * "value" : "${3}"
+ * } ],
+ * "00000000-0000-0000-0000-000000000222" : [ {
+ * "value" : "${4}"
+ * } ]
+ * }
+ * }
+ * ]
+ *
+ */
+ template?: string;
+};
+
+export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & {
+ baz: number | null;
+ qux: number;
+};
+
+/**
+ * Model used to test deduplication strategy (unused)
+ */
+export type ParameterSimpleParameterUnused = string;
+
+/**
+ * Model used to test deduplication strategy
+ */
+export type PostServiceWithEmptyTagResponse = string;
+
+/**
+ * Model used to test deduplication strategy
+ */
+export type PostServiceWithEmptyTagResponse2 = string;
+
+/**
+ * Model used to test deduplication strategy
+ */
+export type DeleteFooData = string;
+
+/**
+ * Model used to test deduplication strategy
+ */
+export type DeleteFooData2 = string;
+
+/**
+ * Model with restricted keyword name
+ */
+export type Import = string;
+
+export type SchemaWithFormRestrictedKeys = {
+ description?: string;
+ 'x-enum-descriptions'?: string;
+ 'x-enum-varnames'?: string;
+ 'x-enumNames'?: string;
+ title?: string;
+ object?: {
+ description?: string;
+ 'x-enum-descriptions'?: string;
+ 'x-enum-varnames'?: string;
+ 'x-enumNames'?: string;
+ title?: string;
+ };
+ array?: Array<{
+ description?: string;
+ 'x-enum-descriptions'?: string;
+ 'x-enum-varnames'?: string;
+ 'x-enumNames'?: string;
+ title?: string;
+ }>;
+};
+
+/**
+ * This schema was giving PascalCase transformations a hard time
+ */
+export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = {
+ /**
+ * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned.
+ */
+ preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions;
+};
+
+/**
+ * This schema was giving PascalCase transformations a hard time
+ */
+export type IoK8sApimachineryPkgApisMetaV1Preconditions = {
+ /**
+ * Specifies the target ResourceVersion
+ */
+ resourceVersion?: string;
+ /**
+ * Specifies the target UID.
+ */
+ uid?: string;
+};
+
+export type AdditionalPropertiesUnknownIssue = {
+ [key: string]: string | number;
+};
+
+export type AdditionalPropertiesUnknownIssue2 = {
+ [key: string]: string | number;
+};
+
+export type AdditionalPropertiesUnknownIssue3 = string & {
+ entries: {
+ [key: string]: AdditionalPropertiesUnknownIssue;
+ };
+};
+
+export type AdditionalPropertiesIntegerIssue = {
+ value: number;
+ [key: string]: number;
+};
+
+export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString;
+
+export type GenericSchemaDuplicateIssue1SystemBoolean = {
+ item?: boolean;
+ error?: string | null;
+ readonly hasError?: boolean;
+ data?: {
+ [key: string]: never;
+ };
+};
+
+export type GenericSchemaDuplicateIssue1SystemString = {
+ item?: string | null;
+ error?: string | null;
+ readonly hasError?: boolean;
+};
+
+export type ExternalSharedModel = {
+ id: string;
+ name?: string;
+};
+
+/**
+ * This is a model with one property containing a reference
+ */
+export type ModelWithReferenceWritable = {
+ prop?: ModelWithPropertiesWritable;
+};
+
+/**
+ * This is a model with one property containing an array
+ */
+export type ModelWithArrayReadOnlyAndWriteOnlyWritable = {
+ prop?: Array;
+ propWithFile?: Array;
+ propWithNumber?: Array;
+};
+
+/**
+ * This is a model with one nested property
+ */
+export type ModelWithPropertiesWritable = {
+ required: string;
+ requiredAndNullable: string | null;
+ string?: string;
+ number?: number;
+ boolean?: boolean;
+ reference?: ModelWithString;
+ 'property with space'?: string;
+ default?: string;
+ try?: string;
+};
+
+/**
+ * This is a model that contains a some patterns
+ */
+export type ModelWithPatternWritable = {
+ key: string;
+ name: string;
+ id?: string;
+ text?: string;
+ patternWithSingleQuotes?: string;
+ patternWithNewline?: string;
+ patternWithBacktick?: string;
+ patternWithUnicode?: string;
+};
+
+export type FileWritable = {
+ /**
+ * Mime
+ */
+ mime: string;
+};
+
+export type ModelWithReadOnlyAndWriteOnlyWritable = {
+ foo: string;
+ baz: string;
+};
+
+export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [
+ number | Import,
+ number | Import
+];
+
+export type AdditionalPropertiesUnknownIssueWritable = {
+ [key: string]: string | number;
+};
+
+export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString;
+
+export type GenericSchemaDuplicateIssue1SystemBooleanWritable = {
+ item?: boolean;
+ error?: string | null;
+ data?: {
+ [key: string]: never;
+ };
+};
+
+export type GenericSchemaDuplicateIssue1SystemStringWritable = {
+ item?: string | null;
+ error?: string | null;
+};
+
+/**
+ * This is a reusable parameter
+ */
+export type SimpleParameter = string;
+
+/**
+ * Parameter with illegal characters
+ */
+export type XFooBar = ModelWithString;
+
+/**
+ * A reusable request body
+ */
+export type SimpleRequestBody = ModelWithString;
+
+/**
+ * A reusable request body
+ */
+export type SimpleFormData = ModelWithString;
+
+export type ExportData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no+tag';
+};
+
+export type PatchApiVbyApiVersionNoTagData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no+tag';
+};
+
+export type PatchApiVbyApiVersionNoTagResponses = {
+ /**
+ * OK
+ */
+ default: unknown;
+};
+
+export type ImportData = {
+ body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no+tag';
+};
+
+export type ImportResponses = {
+ /**
+ * Success
+ */
+ 200: ModelFromZendesk;
+ /**
+ * Default success response
+ */
+ default: ModelWithReadOnlyAndWriteOnly;
+};
+
+export type ImportResponse = ImportResponses[keyof ImportResponses];
+
+export type FooWowData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no+tag';
+};
+
+export type FooWowResponses = {
+ /**
+ * OK
+ */
+ default: unknown;
+};
+
+export type ApiVVersionODataControllerCountData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple/$count';
+};
+
+export type ApiVVersionODataControllerCountResponses = {
+ /**
+ * Success
+ */
+ 200: ModelFromZendesk;
+};
+
+export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses];
+
+export type GetApiVbyApiVersionSimpleOperationData = {
+ body?: never;
+ path: {
+ /**
+ * foo in method
+ */
+ foo_param: string;
+ };
+ query?: never;
+ url: '/api/v{api-version}/simple:operation';
+};
+
+export type GetApiVbyApiVersionSimpleOperationErrors = {
+ /**
+ * Default error response
+ */
+ default: ModelWithBoolean;
+};
+
+export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors];
+
+export type GetApiVbyApiVersionSimpleOperationResponses = {
+ /**
+ * Response is a simple number
+ */
+ 200: number;
+};
+
+export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses];
+
+export type DeleteCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type GetCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type HeadCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type OptionsCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type PatchCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type PostCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type PutCallWithoutParametersAndResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/simple';
+};
+
+export type DeleteFooData3 = {
+ body?: never;
+ headers: {
+ /**
+ * Parameter with illegal characters
+ */
+ 'x-Foo-Bar': ModelWithString;
+ };
+ path: {
+ /**
+ * foo in method
+ */
+ foo_param: string;
+ /**
+ * bar in method
+ */
+ BarParam: string;
+ };
+ query?: never;
+ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}';
+};
+
+export type CallWithDescriptionsData = {
+ body?: never;
+ path?: never;
+ query?: {
+ /**
+ * Testing multiline comments in string: First line
+ * Second line
+ *
+ * Fourth line
+ */
+ parameterWithBreaks?: string;
+ /**
+ * Testing backticks in string: `backticks` and ```multiple backticks``` should work
+ */
+ parameterWithBackticks?: string;
+ /**
+ * Testing slashes in string: \backwards\\\ and /forwards/// should work
+ */
+ parameterWithSlashes?: string;
+ /**
+ * Testing expression placeholders in string: ${expression} should work
+ */
+ parameterWithExpressionPlaceholders?: string;
+ /**
+ * Testing quotes in string: 'single quote''' and "double quotes""" should work
+ */
+ parameterWithQuotes?: string;
+ /**
+ * Testing reserved characters in string: * inline * and ** inline ** should work
+ */
+ parameterWithReservedCharacters?: string;
+ };
+ url: '/api/v{api-version}/descriptions';
+};
+
+export type DeprecatedCallData = {
+ body?: never;
+ headers: {
+ /**
+ * This parameter is deprecated
+ *
+ * @deprecated
+ */
+ parameter: DeprecatedModel | null;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/parameters/deprecated';
+};
+
+export type CallWithParametersData = {
+ /**
+ * This is the parameter that goes into the body
+ */
+ body: {
+ [key: string]: unknown;
+ } | null;
+ headers: {
+ /**
+ * This is the parameter that goes into the header
+ */
+ parameterHeader: string | null;
+ };
+ path: {
+ /**
+ * This is the parameter that goes into the path
+ */
+ parameterPath: string | null;
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string | null;
+ };
+ query: {
+ foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo;
+ foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo;
+ /**
+ * This is the parameter that goes into the query params
+ */
+ cursor: string | null;
+ };
+ url: '/api/v{api-version}/parameters/{parameterPath}';
+};
+
+export type CallWithWeirdParameterNamesData = {
+ /**
+ * This is the parameter that goes into the body
+ */
+ body: ModelWithString | null;
+ headers: {
+ /**
+ * This is the parameter that goes into the request header
+ */
+ 'parameter.header': string | null;
+ };
+ path: {
+ /**
+ * This is the parameter that goes into the path
+ */
+ 'parameter.path.1'?: string;
+ /**
+ * This is the parameter that goes into the path
+ */
+ 'parameter-path-2'?: string;
+ /**
+ * This is the parameter that goes into the path
+ */
+ 'PARAMETER-PATH-3'?: string;
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string | null;
+ };
+ query: {
+ /**
+ * This is the parameter with a reserved keyword
+ */
+ default?: string;
+ /**
+ * This is the parameter that goes into the request query params
+ */
+ 'parameter-query': string | null;
+ };
+ url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}';
+};
+
+export type GetCallWithOptionalParamData = {
+ /**
+ * This is a required parameter
+ */
+ body: ModelWithOneOfEnum;
+ path?: never;
+ query?: {
+ /**
+ * This is an optional parameter
+ */
+ page?: number;
+ };
+ url: '/api/v{api-version}/parameters';
+};
+
+export type PostCallWithOptionalParamData = {
+ /**
+ * This is an optional parameter
+ */
+ body?: {
+ offset?: number | null;
+ };
+ path?: never;
+ query: {
+ /**
+ * This is a required parameter
+ */
+ parameter: Pageable;
+ };
+ url: '/api/v{api-version}/parameters';
+};
+
+export type PostCallWithOptionalParamResponses = {
+ /**
+ * Response is a simple number
+ */
+ 200: number;
+ /**
+ * Success
+ */
+ 204: void;
+};
+
+export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses];
+
+export type PostApiVbyApiVersionRequestBodyData = {
+ /**
+ * A reusable request body
+ */
+ body?: SimpleRequestBody;
+ path?: never;
+ query?: {
+ /**
+ * This is a reusable parameter
+ */
+ parameter?: string;
+ };
+ url: '/api/v{api-version}/requestBody';
+};
+
+export type PostApiVbyApiVersionFormDataData = {
+ /**
+ * A reusable request body
+ */
+ body?: SimpleFormData;
+ path?: never;
+ query?: {
+ /**
+ * This is a reusable parameter
+ */
+ parameter?: string;
+ };
+ url: '/api/v{api-version}/formData';
+};
+
+export type CallWithDefaultParametersData = {
+ body?: never;
+ path?: never;
+ query?: {
+ /**
+ * This is a simple string with default value
+ */
+ parameterString?: string | null;
+ /**
+ * This is a simple number with default value
+ */
+ parameterNumber?: number | null;
+ /**
+ * This is a simple boolean with default value
+ */
+ parameterBoolean?: boolean | null;
+ /**
+ * This is a simple enum with default value
+ */
+ parameterEnum?: 'Success' | 'Warning' | 'Error';
+ /**
+ * This is a simple model with default value
+ */
+ parameterModel?: ModelWithString | null;
+ };
+ url: '/api/v{api-version}/defaults';
+};
+
+export type CallWithDefaultOptionalParametersData = {
+ body?: never;
+ path?: never;
+ query?: {
+ /**
+ * This is a simple string that is optional with default value
+ */
+ parameterString?: string;
+ /**
+ * This is a simple number that is optional with default value
+ */
+ parameterNumber?: number;
+ /**
+ * This is a simple boolean that is optional with default value
+ */
+ parameterBoolean?: boolean;
+ /**
+ * This is a simple enum that is optional with default value
+ */
+ parameterEnum?: 'Success' | 'Warning' | 'Error';
+ /**
+ * This is a simple model that is optional with default value
+ */
+ parameterModel?: ModelWithString;
+ };
+ url: '/api/v{api-version}/defaults';
+};
+
+export type CallToTestOrderOfParamsData = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * This is a optional string with default
+ */
+ parameterOptionalStringWithDefault?: string;
+ /**
+ * This is a optional string with empty default
+ */
+ parameterOptionalStringWithEmptyDefault?: string;
+ /**
+ * This is a optional string with no default
+ */
+ parameterOptionalStringWithNoDefault?: string;
+ /**
+ * This is a string with default
+ */
+ parameterStringWithDefault: string;
+ /**
+ * This is a string with empty default
+ */
+ parameterStringWithEmptyDefault: string;
+ /**
+ * This is a string with no default
+ */
+ parameterStringWithNoDefault: string;
+ /**
+ * This is a string that can be null with no default
+ */
+ parameterStringNullableWithNoDefault?: string | null;
+ /**
+ * This is a string that can be null with default
+ */
+ parameterStringNullableWithDefault?: string | null;
+ };
+ url: '/api/v{api-version}/defaults';
+};
+
+export type DuplicateNameData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/duplicate';
+};
+
+export type DuplicateName2Data = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/duplicate';
+};
+
+export type DuplicateName3Data = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/duplicate';
+};
+
+export type DuplicateName4Data = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/duplicate';
+};
+
+export type CallWithNoContentResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/no-content';
+};
+
+export type CallWithNoContentResponseResponses = {
+ /**
+ * Success
+ */
+ 204: void;
+};
+
+export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses];
+
+export type CallWithResponseAndNoContentResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multiple-tags/response-and-no-content';
+};
+
+export type CallWithResponseAndNoContentResponseResponses = {
+ /**
+ * Response is a simple number
+ */
+ 200: number;
+ /**
+ * Success
+ */
+ 204: void;
+};
+
+export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses];
+
+export type DummyAData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multiple-tags/a';
+};
+
+export type DummyAResponses = {
+ 200: _400;
+};
+
+export type DummyAResponse = DummyAResponses[keyof DummyAResponses];
+
+export type DummyBData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multiple-tags/b';
+};
+
+export type DummyBResponses = {
+ /**
+ * Success
+ */
+ 204: void;
+};
+
+export type DummyBResponse = DummyBResponses[keyof DummyBResponses];
+
+export type CallWithResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/response';
+};
+
+export type CallWithResponseResponses = {
+ default: Import;
+};
+
+export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses];
+
+export type CallWithDuplicateResponsesData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/response';
+};
+
+export type CallWithDuplicateResponsesErrors = {
+ /**
+ * Message for 500 error
+ */
+ 500: ModelWithStringError;
+ /**
+ * Message for 501 error
+ */
+ 501: ModelWithStringError;
+ /**
+ * Message for 502 error
+ */
+ 502: ModelWithStringError;
+ /**
+ * Message for 4XX errors
+ */
+ '4XX': DictionaryWithArray;
+ /**
+ * Default error response
+ */
+ default: ModelWithBoolean;
+};
+
+export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors];
+
+export type CallWithDuplicateResponsesResponses = {
+ /**
+ * Message for 200 response
+ */
+ 200: ModelWithBoolean & ModelWithInteger;
+ /**
+ * Message for 201 response
+ */
+ 201: ModelWithString;
+ /**
+ * Message for 202 response
+ */
+ 202: ModelWithString;
+};
+
+export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses];
+
+export type CallWithResponsesData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/response';
+};
+
+export type CallWithResponsesErrors = {
+ /**
+ * Message for 500 error
+ */
+ 500: ModelWithStringError;
+ /**
+ * Message for 501 error
+ */
+ 501: ModelWithStringError;
+ /**
+ * Message for 502 error
+ */
+ 502: ModelWithStringError;
+ /**
+ * Message for default response
+ */
+ default: ModelWithStringError;
+};
+
+export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors];
+
+export type CallWithResponsesResponses = {
+ /**
+ * Message for 200 response
+ */
+ 200: {
+ readonly '@namespace.string'?: string;
+ readonly '@namespace.integer'?: number;
+ readonly value?: Array;
+ };
+ /**
+ * Message for 201 response
+ */
+ 201: ModelThatExtends;
+ /**
+ * Message for 202 response
+ */
+ 202: ModelThatExtendsExtends;
+};
+
+export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses];
+
+export type CollectionFormatData = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * This is an array parameter that is sent as csv format (comma-separated values)
+ */
+ parameterArrayCSV: Array | null;
+ /**
+ * This is an array parameter that is sent as ssv format (space-separated values)
+ */
+ parameterArraySSV: Array | null;
+ /**
+ * This is an array parameter that is sent as tsv format (tab-separated values)
+ */
+ parameterArrayTSV: Array | null;
+ /**
+ * This is an array parameter that is sent as pipes format (pipe-separated values)
+ */
+ parameterArrayPipes: Array | null;
+ /**
+ * This is an array parameter that is sent as multi format (multiple parameter instances)
+ */
+ parameterArrayMulti: Array | null;
+ };
+ url: '/api/v{api-version}/collectionFormat';
+};
+
+export type TypesData = {
+ body?: never;
+ path?: {
+ /**
+ * This is a number parameter
+ */
+ id?: number;
+ };
+ query: {
+ /**
+ * This is a number parameter
+ */
+ parameterNumber: number;
+ /**
+ * This is a string parameter
+ */
+ parameterString: string | null;
+ /**
+ * This is a boolean parameter
+ */
+ parameterBoolean: boolean | null;
+ /**
+ * This is an object parameter
+ */
+ parameterObject: {
+ [key: string]: unknown;
+ } | null;
+ /**
+ * This is an array parameter
+ */
+ parameterArray: Array | null;
+ /**
+ * This is a dictionary parameter
+ */
+ parameterDictionary: {
+ [key: string]: unknown;
+ } | null;
+ /**
+ * This is an enum parameter
+ */
+ parameterEnum: 'Success' | 'Warning' | 'Error' | null;
+ };
+ url: '/api/v{api-version}/types';
+};
+
+export type TypesResponses = {
+ /**
+ * Response is a simple number
+ */
+ 200: number;
+ /**
+ * Response is a simple string
+ */
+ 201: string;
+ /**
+ * Response is a simple boolean
+ */
+ 202: boolean;
+ /**
+ * Response is a simple object
+ */
+ 203: {
+ [key: string]: unknown;
+ };
+};
+
+export type TypesResponse = TypesResponses[keyof TypesResponses];
+
+export type UploadFileData = {
+ body: Blob | File;
+ path: {
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string | null;
+ };
+ query?: never;
+ url: '/api/v{api-version}/upload';
+};
+
+export type UploadFileResponses = {
+ 200: boolean;
+};
+
+export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses];
+
+export type FileResponseData = {
+ body?: never;
+ path: {
+ id: string;
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string;
+ };
+ query?: never;
+ url: '/api/v{api-version}/file/{id}';
+};
+
+export type FileResponseResponses = {
+ /**
+ * Success
+ */
+ 200: Blob | File;
+};
+
+export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses];
+
+export type ComplexTypesData = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * Parameter containing object
+ */
+ parameterObject: {
+ first?: {
+ second?: {
+ third?: string;
+ };
+ };
+ };
+ /**
+ * Parameter containing reference
+ */
+ parameterReference: ModelWithString;
+ };
+ url: '/api/v{api-version}/complex';
+};
+
+export type ComplexTypesErrors = {
+ /**
+ * 400 `server` error
+ */
+ 400: unknown;
+ /**
+ * 500 server error
+ */
+ 500: unknown;
+};
+
+export type ComplexTypesResponses = {
+ /**
+ * Successful response
+ */
+ 200: Array;
+};
+
+export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses];
+
+export type MultipartResponseData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multipart';
+};
+
+export type MultipartResponseResponses = {
+ /**
+ * OK
+ */
+ 200: {
+ file?: Blob | File;
+ metadata?: {
+ foo?: string;
+ bar?: string;
+ };
+ };
+};
+
+export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses];
+
+export type MultipartRequestData = {
+ body?: {
+ content?: Blob | File;
+ data?: ModelWithString | null;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/multipart';
+};
+
+export type ComplexParamsData = {
+ body?: {
+ readonly key: string | null;
+ name: string | null;
+ enabled?: boolean;
+ type: 'Monkey' | 'Horse' | 'Bird';
+ listOfModels?: Array | null;
+ listOfStrings?: Array | null;
+ parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary;
+ readonly user?: {
+ readonly id?: number;
+ readonly name?: string | null;
+ };
+ };
+ path: {
+ id: number;
+ /**
+ * api-version should be required in standalone clients
+ */
+ 'api-version': string;
+ };
+ query?: never;
+ url: '/api/v{api-version}/complex/{id}';
+};
+
+export type ComplexParamsResponses = {
+ /**
+ * Success
+ */
+ 200: ModelWithString;
+};
+
+export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses];
+
+export type CallWithResultFromHeaderData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/header';
+};
+
+export type CallWithResultFromHeaderErrors = {
+ /**
+ * 400 server error
+ */
+ 400: unknown;
+ /**
+ * 500 server error
+ */
+ 500: unknown;
+};
+
+export type CallWithResultFromHeaderResponses = {
+ /**
+ * Successful response
+ */
+ 200: unknown;
+};
+
+export type TestErrorCodeData = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * Status code to return
+ */
+ status: number;
+ };
+ url: '/api/v{api-version}/error';
+};
+
+export type TestErrorCodeErrors = {
+ /**
+ * 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;
+};
+
+export type TestErrorCodeResponses = {
+ /**
+ * Custom message: Successful response
+ */
+ 200: unknown;
+};
+
+export type NonAsciiæøåÆøÅöôêÊ字符串Data = {
+ body?: never;
+ path?: never;
+ query: {
+ /**
+ * Dummy input param
+ */
+ nonAsciiParamæøåÆØÅöôêÊ: number;
+ };
+ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串';
+};
+
+export type NonAsciiæøåÆøÅöôêÊ字符串Responses = {
+ /**
+ * Successful response
+ */
+ 200: Array;
+};
+
+export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses];
+
+export type PutWithFormUrlEncodedData = {
+ body: ArrayWithStrings;
+ path?: never;
+ query?: never;
+ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串';
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-locale/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-locale/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..b16676e78c
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-locale/@faker-js/faker.gen.ts
@@ -0,0 +1,511 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import type { Faker } from '@faker-js/faker';
+import { faker } from '@faker-js/faker/locale/de';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakePrice = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeQuantity = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeActive = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeNothing = () => null;
+
+export const fakeAnything = () => undefined;
+
+export const fakeStatusWithNull = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'active',
+ 'inactive',
+ null
+ ]);
+};
+
+export const fakeNumericEnum = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3
+ ]);
+};
+
+export const fakeEmail = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeDateTime = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString();
+};
+
+export const fakeDateOnly = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString().slice(0, 10);
+};
+
+export const fakeUniqueId = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.uuid();
+};
+
+export const fakeWebsite = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.url();
+};
+
+export const fakeIPv4Address = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv4();
+};
+
+export const fakeIPv6Address = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv6();
+};
+
+export const fakeZipCode = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.fromRegExp('^\\d{5}(-\\d{4})?$');
+};
+
+export const fakeShortName = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 2, max: 50 } });
+};
+
+export const fakeMinOnlyString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 10, max: 100 } });
+};
+
+export const fakeMaxOnlyString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 0, max: 5 } });
+};
+
+export const fakeEmailWithLength = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeBoundedInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeBoundedFloat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 9 });
+};
+
+export const fakeMinOnlyNumber = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0 });
+};
+
+export const fakeMaxOnlyInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ max: 999 });
+};
+
+export const fakeExclusiveFloat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveFloatNarrow = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 10.1, max: 10.2 });
+};
+
+export const fakeTags = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeTagList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 1, max: 10 } });
+};
+
+export const fakeMinOnlyArray = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int(), { count: { min: 3, max: 100 } });
+};
+
+export const fakeMaxOnlyArray = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 0, max: 5 } });
+};
+
+export const fakeDefaultString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 'unknown' : f.string.sample();
+};
+
+export const fakeDefaultInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int();
+};
+
+export const fakeDefaultBool = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean();
+};
+
+export const fakeDefaultOverridesConstraints = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 42 : f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeNullableString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.string.sample() : null;
+};
+
+export const fakeNullableInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.number.int() : null;
+};
+
+export const fakeObjectWithDefaultProp = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { status: resolveCondition(options?.useDefault ?? false, f) ? 'active' : f.string.sample() }
+ };
+};
+
+export const fakeDictionaryObject = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.string.sample()
+ };
+};
+
+export const fakeUserProfile = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bio: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) }
+ };
+};
+
+export const fakeTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ label: f.string.sample()
+ };
+};
+
+export const fakePet = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ };
+};
+
+export const fakeError = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ code: f.number.int(),
+ message: f.string.sample()
+ };
+};
+
+export const fakeAddress = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ street: f.location.streetAddress(),
+ zip: fakeZipCode(options)
+ };
+};
+
+export const fakePerson = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: fakeShortName(options),
+ email: fakeEmail(options),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { address: fakeAddress(options) }
+ };
+};
+
+export const fakePersonList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePerson(options), { count: { min: 1, max: 20 } });
+};
+
+export const fakePetList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeTeam = (options?: Options) => ({
+ lead: fakePerson(options),
+ config: fakeObjectWithDefaultProp(options)
+});
+
+export const fakePetOrTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([fakePet(options), fakeTag(options)]);
+};
+
+export const fakeStringOrNumber = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([f.string.sample(), f.number.float()]);
+};
+
+export const fakeNullablePetOrTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ fakePet(options),
+ fakeTag(options),
+ null
+ ]);
+};
+
+export const fakePetWithOwner = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakePet(options), {
+ owner: f.string.sample()
+ });
+};
+
+export const fakeCircle = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ radius: f.number.float()
+ };
+};
+
+export const fakeSquare = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ side: f.number.float()
+ };
+};
+
+export const fakeShape = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeCircle(options)),
+ kind: 'Circle' as const
+ }, {
+ ...Object.assign({}, fakeSquare(options)),
+ kind: 'Square' as const
+ }]);
+};
+
+export const fakeDog = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ bark: f.datatype.boolean()
+ };
+};
+
+export const fakeCat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ purr: f.datatype.boolean()
+ };
+};
+
+export const fakeAnimal = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeDog(options)),
+ type: 'dog' as const
+ }, {
+ ...Object.assign({}, fakeCat(options)),
+ type: 'cat' as const
+ }]);
+};
+
+export const fakePersonProfile = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ firstName: f.person.firstName(),
+ last_name: f.person.lastName(),
+ email: f.internet.email(),
+ phone: f.phone.number(),
+ homePhone: f.phone.number(),
+ age: f.number.int({ max: 120, min: 1 }),
+ city: f.location.city(),
+ postalCode: f.location.zipCode(),
+ bio: f.lorem.sentence(),
+ website: f.internet.url(),
+ zipCode: f.helpers.fromRegExp('^\\d{5}$'),
+ username: f.internet.username(),
+ someRandomField: f.string.sample()
+ };
+};
+
+export const fakePersonWithConstraints = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ age: f.number.int({ max: 120, min: 18 }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { seniorAge: f.number.int({ min: 65, max: 100 }) }
+ };
+};
+
+export const fakeUser = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.person.fullName(),
+ email: f.internet.email()
+ };
+};
+
+export const fakeCompany = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.company.name()
+ };
+};
+
+export const fakeConfig = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample()
+ };
+};
+
+export const fakeNeverArray = () => [];
+
+export const fakeObjectWithOptionalNever = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int()
+ };
+};
+
+export const fakeDocument = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ _id: f.string.uuid(),
+ numericId: f.number.int()
+ };
+};
+
+export const fakeListPetsRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { limit: f.number.int({ min: 1, max: 100 }) }
+ }
+ };
+};
+
+export const fakeListPetsResponse = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeCreatePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCreatePetResponse = (options?: Options) => fakePet(options);
+
+export const fakeDeletePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeDeletePetResponse404 = (options?: Options) => fakeError(options);
+
+export const fakeGetPetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeGetPetResponse200 = (options?: Options) => fakePet(options);
+
+export const fakeGetPetResponse404 = (options?: Options) => fakeError(options);
+
+export const fakeUpdatePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ },
+ path: {
+ id: f.string.uuid()
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dryRun: f.datatype.boolean() }
+ }
+ };
+};
+
+export const fakeUpdatePetResponse = (options?: Options) => fakePet(options);
+
+export const fakeCreateJobResponse2Xx = (options?: Options) => fakePet(options);
+
+export const fakeCreateJobResponse4Xx = (options?: Options) => fakeError(options);
+
+export const fakeHealthCheckResponse = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..f88936ac61
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/@faker-js/faker.gen.ts
@@ -0,0 +1,512 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import { faker, type Faker } from '@faker-js/faker';
+
+import type { Active, Address, Animal, Anything, BoundedFloat, BoundedInt, Cat, Circle, Company, Config, CreateJobErrors, CreateJobResponses, CreatePetData, CreatePetResponse, DateOnly, DateTime, DefaultBool, DefaultInt, DefaultOverridesConstraints, DefaultString, DeletePetData, DeletePetErrors, DictionaryObject, Document, Dog, Email, EmailWithLength, Error, ExclusiveFloat, ExclusiveFloatNarrow, ExclusiveInt, GetPetData, GetPetErrors, GetPetResponses, HealthCheckResponse, IPv4Address, IPv6Address, ListPetsData, ListPetsResponse, MaxOnlyArray, MaxOnlyInt, MaxOnlyString, MinOnlyArray, MinOnlyNumber, MinOnlyString, NeverArray, Nothing, NullableInt, NullablePetOrTag, NullableString, NumericEnum, ObjectWithDefaultProp, ObjectWithOptionalNever, Person, PersonList, PersonProfile, PersonWithConstraints, Pet, PetList, PetOrTag, PetWithOwner, Price, Quantity, Shape, ShortName, Square, StatusWithNull, StringOrNumber, Tag, TagList, Tags, Team, UniqueId, UpdatePetData, UpdatePetResponse, User, UserProfile, Website, ZipCode } from '../types.gen';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakePrice = (options?: Options): Price => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeQuantity = (options?: Options): Quantity => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeActive = (options?: Options): Active => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeNothing = (): Nothing => null;
+
+export const fakeAnything = (): Anything => undefined;
+
+export const fakeStatusWithNull = (options?: Options): StatusWithNull => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'active',
+ 'inactive',
+ null
+ ]);
+};
+
+export const fakeNumericEnum = (options?: Options): NumericEnum => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3
+ ]);
+};
+
+export const fakeEmail = (options?: Options): Email => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeDateTime = (options?: Options): DateTime => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString();
+};
+
+export const fakeDateOnly = (options?: Options): DateOnly => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString().slice(0, 10);
+};
+
+export const fakeUniqueId = (options?: Options): UniqueId => {
+ const f = options?.faker ?? faker;
+ return f.string.uuid();
+};
+
+export const fakeWebsite = (options?: Options): Website => {
+ const f = options?.faker ?? faker;
+ return f.internet.url();
+};
+
+export const fakeIPv4Address = (options?: Options): IPv4Address => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv4();
+};
+
+export const fakeIPv6Address = (options?: Options): IPv6Address => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv6();
+};
+
+export const fakeZipCode = (options?: Options): ZipCode => {
+ const f = options?.faker ?? faker;
+ return f.helpers.fromRegExp('^\\d{5}(-\\d{4})?$');
+};
+
+export const fakeShortName = (options?: Options): ShortName => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 2, max: 50 } });
+};
+
+export const fakeMinOnlyString = (options?: Options): MinOnlyString => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 10, max: 100 } });
+};
+
+export const fakeMaxOnlyString = (options?: Options): MaxOnlyString => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 0, max: 5 } });
+};
+
+export const fakeEmailWithLength = (options?: Options): EmailWithLength => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeBoundedInt = (options?: Options): BoundedInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeBoundedFloat = (options?: Options): BoundedFloat => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveInt = (options?: Options): ExclusiveInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 9 });
+};
+
+export const fakeMinOnlyNumber = (options?: Options): MinOnlyNumber => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0 });
+};
+
+export const fakeMaxOnlyInt = (options?: Options): MaxOnlyInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ max: 999 });
+};
+
+export const fakeExclusiveFloat = (options?: Options): ExclusiveFloat => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveFloatNarrow = (options?: Options): ExclusiveFloatNarrow => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 10.1, max: 10.2 });
+};
+
+export const fakeTags = (options?: Options): Tags => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeTagList = (options?: Options): TagList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 1, max: 10 } });
+};
+
+export const fakeMinOnlyArray = (options?: Options): MinOnlyArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int(), { count: { min: 3, max: 100 } });
+};
+
+export const fakeMaxOnlyArray = (options?: Options): MaxOnlyArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 0, max: 5 } });
+};
+
+export const fakeDefaultString = (options?: Options): DefaultString => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 'unknown' : f.string.sample();
+};
+
+export const fakeDefaultInt = (options?: Options): DefaultInt => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int();
+};
+
+export const fakeDefaultBool = (options?: Options): DefaultBool => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean();
+};
+
+export const fakeDefaultOverridesConstraints = (options?: Options): DefaultOverridesConstraints => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 42 : f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeNullableString = (options?: Options): NullableString => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.string.sample() : null;
+};
+
+export const fakeNullableInt = (options?: Options): NullableInt => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.number.int() : null;
+};
+
+export const fakeObjectWithDefaultProp = (options?: Options): ObjectWithDefaultProp => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { status: resolveCondition(options?.useDefault ?? false, f) ? 'active' : f.string.sample() }
+ };
+};
+
+export const fakeDictionaryObject = (options?: Options): DictionaryObject => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.string.sample()
+ };
+};
+
+export const fakeUserProfile = (options?: Options): UserProfile => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bio: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) }
+ };
+};
+
+export const fakeTag = (options?: Options): Tag => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ label: f.string.sample()
+ };
+};
+
+export const fakePet = (options?: Options): Pet => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ };
+};
+
+export const fakeError = (options?: Options): Error => {
+ const f = options?.faker ?? faker;
+ return {
+ code: f.number.int(),
+ message: f.word.words({ count: 4 })
+ };
+};
+
+export const fakeAddress = (options?: Options): Address => {
+ const f = options?.faker ?? faker;
+ return {
+ street: f.location.streetAddress(),
+ zip: fakeZipCode(options)
+ };
+};
+
+export const fakePerson = (options?: Options): Person => {
+ const f = options?.faker ?? faker;
+ return {
+ name: fakeShortName(options),
+ email: fakeEmail(options),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { address: fakeAddress(options) }
+ };
+};
+
+export const fakePersonList = (options?: Options): PersonList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePerson(options), { count: { min: 1, max: 20 } });
+};
+
+export const fakePetList = (options?: Options): PetList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeTeam = (options?: Options): Team => ({
+ lead: fakePerson(options),
+ config: fakeObjectWithDefaultProp(options)
+});
+
+export const fakePetOrTag = (options?: Options): PetOrTag => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([fakePet(options), fakeTag(options)]);
+};
+
+export const fakeStringOrNumber = (options?: Options): StringOrNumber => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([f.string.sample(), f.number.float()]);
+};
+
+export const fakeNullablePetOrTag = (options?: Options): NullablePetOrTag => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ fakePet(options),
+ fakeTag(options),
+ null
+ ]);
+};
+
+export const fakePetWithOwner = (options?: Options): PetWithOwner => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakePet(options), {
+ owner: f.string.sample()
+ });
+};
+
+export const fakeCircle = (options?: Options): Circle => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ radius: f.number.float()
+ };
+};
+
+export const fakeSquare = (options?: Options): Square => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ side: f.number.float()
+ };
+};
+
+export const fakeShape = (options?: Options): Shape => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeCircle(options)),
+ kind: 'Circle' as const
+ }, {
+ ...Object.assign({}, fakeSquare(options)),
+ kind: 'Square' as const
+ }]);
+};
+
+export const fakeDog = (options?: Options): Dog => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ bark: f.datatype.boolean()
+ };
+};
+
+export const fakeCat = (options?: Options): Cat => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ purr: f.datatype.boolean()
+ };
+};
+
+export const fakeAnimal = (options?: Options): Animal => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeDog(options)),
+ type: 'dog' as const
+ }, {
+ ...Object.assign({}, fakeCat(options)),
+ type: 'cat' as const
+ }]);
+};
+
+export const fakePersonProfile = (options?: Options): PersonProfile => {
+ const f = options?.faker ?? faker;
+ return {
+ firstName: f.person.firstName(),
+ last_name: f.person.lastName(),
+ email: f.internet.email(),
+ phone: f.phone.number(),
+ homePhone: f.phone.number(),
+ age: f.number.int({ max: 120, min: 1 }),
+ city: f.location.city(),
+ postalCode: f.location.zipCode(),
+ bio: f.lorem.sentence(),
+ website: f.internet.url(),
+ zipCode: f.helpers.fromRegExp('^\\d{5}$'),
+ username: f.internet.username(),
+ someRandomField: f.string.sample()
+ };
+};
+
+export const fakePersonWithConstraints = (options?: Options): PersonWithConstraints => {
+ const f = options?.faker ?? faker;
+ return {
+ age: f.number.int({ max: 120, min: 18 }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { seniorAge: f.number.int({ min: 65, max: 100 }) }
+ };
+};
+
+export const fakeUser = (options?: Options): User => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.person.fullName(),
+ email: f.internet.email()
+ };
+};
+
+export const fakeCompany = (options?: Options): Company => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.company.name()
+ };
+};
+
+export const fakeConfig = (options?: Options): Config => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample()
+ };
+};
+
+export const fakeNeverArray = (): NeverArray => [];
+
+export const fakeObjectWithOptionalNever = (options?: Options): ObjectWithOptionalNever => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int()
+ };
+};
+
+export const fakeDocument = (options?: Options): Document => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ _id: f.string.uuid(),
+ numericId: f.number.int()
+ };
+};
+
+export const fakeListPetsRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { limit: f.number.int({ min: 1, max: 100 }) }
+ }
+ };
+};
+
+export const fakeListPetsResponse = (options?: Options): ListPetsResponse => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeCreatePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCreatePetResponse = (options?: Options): CreatePetResponse => fakePet(options);
+
+export const fakeDeletePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeDeletePetResponse404 = (options?: Options): DeletePetErrors[404] => fakeError(options);
+
+export const fakeGetPetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeGetPetResponse200 = (options?: Options): GetPetResponses[200] => fakePet(options);
+
+export const fakeGetPetResponse404 = (options?: Options): GetPetErrors[404] => fakeError(options);
+
+export const fakeUpdatePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ },
+ path: {
+ id: f.string.uuid()
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dryRun: f.datatype.boolean() }
+ }
+ };
+};
+
+export const fakeUpdatePetResponse = (options?: Options): UpdatePetResponse => fakePet(options);
+
+export const fakeCreateJobResponse2Xx = (options?: Options): CreateJobResponses['2XX'] => fakePet(options);
+
+export const fakeCreateJobResponse4Xx = (options?: Options): CreateJobErrors['4XX'] => fakeError(options);
+
+export const fakeHealthCheckResponse = (options?: Options): HealthCheckResponse => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/index.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/index.ts
new file mode 100644
index 0000000000..0543fb7fba
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/index.ts
@@ -0,0 +1,3 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type { Active, Address, Animal, Anything, BoundedFloat, BoundedInt, Cat, Circle, ClientOptions, Company, Config, CreateJobData, CreateJobError, CreateJobErrors, CreateJobResponse, CreateJobResponses, CreatePetData, CreatePetResponse, CreatePetResponses, DateOnly, DateTime, DefaultBool, DefaultInt, DefaultOverridesConstraints, DefaultString, DeletePetData, DeletePetError, DeletePetErrors, DeletePetResponse, DeletePetResponses, DictionaryObject, Document, Dog, Email, EmailWithLength, Error, ExclusiveFloat, ExclusiveFloatNarrow, ExclusiveInt, GetPetData, GetPetError, GetPetErrors, GetPetResponse, GetPetResponses, HealthCheckData, HealthCheckResponse, HealthCheckResponses, IPv4Address, IPv6Address, ListPetsData, ListPetsResponse, ListPetsResponses, MaxOnlyArray, MaxOnlyInt, MaxOnlyString, MinOnlyArray, MinOnlyNumber, MinOnlyString, NeverArray, NeverTuple, Nothing, NullableInt, NullablePetOrTag, NullableString, NumericEnum, ObjectWithDefaultProp, ObjectWithOptionalNever, ObjectWithRequiredNever, Person, PersonList, PersonProfile, PersonWithConstraints, Pet, PetList, PetOrTag, PetWithOwner, Price, Quantity, Shape, ShortName, Square, StatusWithNull, StringOrNumber, Tag, TagList, Tags, Team, UniqueId, UpdatePetData, UpdatePetResponse, UpdatePetResponses, User, UserProfile, Website, ZipCode } from './types.gen';
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/types.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/types.gen.ts
new file mode 100644
index 0000000000..17825ee3ff
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-name-rules/types.gen.ts
@@ -0,0 +1,391 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type ClientOptions = {
+ baseUrl: `${string}://${string}` | (string & {});
+};
+
+export type Price = number;
+
+export type Quantity = number;
+
+export type Active = boolean;
+
+export type Nothing = null;
+
+export type Anything = unknown;
+
+export type StatusWithNull = 'active' | 'inactive' | null;
+
+export type NumericEnum = 1 | 2 | 3;
+
+export type Email = string;
+
+export type DateTime = string;
+
+export type DateOnly = string;
+
+export type UniqueId = string;
+
+export type Website = string;
+
+export type IPv4Address = string;
+
+export type IPv6Address = string;
+
+export type ZipCode = string;
+
+export type ShortName = string;
+
+export type MinOnlyString = string;
+
+export type MaxOnlyString = string;
+
+export type EmailWithLength = string;
+
+export type BoundedInt = number;
+
+export type BoundedFloat = number;
+
+export type ExclusiveInt = number;
+
+export type MinOnlyNumber = number;
+
+export type MaxOnlyInt = number;
+
+export type ExclusiveFloat = number;
+
+export type ExclusiveFloatNarrow = number;
+
+export type Tags = Array;
+
+export type TagList = Array;
+
+export type MinOnlyArray = Array;
+
+export type MaxOnlyArray = Array;
+
+export type DefaultString = string;
+
+export type DefaultInt = number;
+
+export type DefaultBool = boolean;
+
+export type DefaultOverridesConstraints = number;
+
+export type NullableString = string | null;
+
+export type NullableInt = number | null;
+
+export type ObjectWithDefaultProp = {
+ name: string;
+ status?: string;
+};
+
+/**
+ * This is a dictionary object
+ */
+export type DictionaryObject = {
+ [key: string]: string;
+};
+
+export type UserProfile = {
+ id: number;
+ name: string;
+ bio?: string;
+ age?: number;
+};
+
+export type Pet = {
+ id: string;
+ name: string;
+ age?: number;
+ tag?: Tag;
+};
+
+export type Tag = {
+ id: number;
+ label: string;
+};
+
+export type Error = {
+ code: number;
+ message: string;
+};
+
+export type Address = {
+ street: string;
+ zip: ZipCode;
+};
+
+export type Person = {
+ name: ShortName;
+ email: Email;
+ address?: Address;
+};
+
+export type PersonList = Array;
+
+export type PetList = Array;
+
+export type Team = {
+ lead: Person;
+ config: ObjectWithDefaultProp;
+};
+
+export type PetOrTag = Pet | Tag;
+
+export type StringOrNumber = string | number;
+
+export type NullablePetOrTag = Pet | Tag | null;
+
+export type PetWithOwner = Pet & {
+ owner: string;
+};
+
+export type Circle = {
+ kind: string;
+ radius: number;
+};
+
+export type Square = {
+ kind: string;
+ side: number;
+};
+
+export type Shape = ({
+ kind: 'Circle';
+} & Circle) | ({
+ kind: 'Square';
+} & Square);
+
+export type Dog = {
+ type: string;
+ bark: boolean;
+};
+
+export type Cat = {
+ type: string;
+ purr: boolean;
+};
+
+export type Animal = ({
+ type: 'dog';
+} & Dog) | ({
+ type: 'cat';
+} & Cat);
+
+export type PersonProfile = {
+ firstName: string;
+ last_name: string;
+ email: string;
+ phone: string;
+ homePhone: string;
+ age: number;
+ city: string;
+ postalCode: string;
+ bio: string;
+ website: string;
+ zipCode: string;
+ username: string;
+ someRandomField: string;
+};
+
+export type PersonWithConstraints = {
+ age: number;
+ seniorAge?: number;
+};
+
+export type User = {
+ name: string;
+ email: string;
+};
+
+export type Company = {
+ name: string;
+};
+
+export type Config = {
+ name: string;
+};
+
+export type NeverTuple = [
+ number & string,
+ number & string
+];
+
+export type NeverArray = Array;
+
+export type ObjectWithRequiredNever = {
+ id: number;
+ impossible: number & string;
+};
+
+export type ObjectWithOptionalNever = {
+ id: number;
+ impossible?: number & string;
+};
+
+export type Document = {
+ id: string;
+ _id: string;
+ numericId: number;
+};
+
+export type ListPetsData = {
+ body?: never;
+ path?: never;
+ query?: {
+ limit?: number;
+ };
+ url: '/pets';
+};
+
+export type ListPetsResponses = {
+ /**
+ * A list of pets
+ */
+ 200: Array;
+};
+
+export type ListPetsResponse = ListPetsResponses[keyof ListPetsResponses];
+
+export type CreatePetData = {
+ body: {
+ name: string;
+ tag?: string;
+ };
+ path?: never;
+ query?: never;
+ url: '/pets';
+};
+
+export type CreatePetResponses = {
+ /**
+ * Pet created
+ */
+ 201: Pet;
+ /**
+ * No content
+ */
+ 204: void;
+};
+
+export type CreatePetResponse = CreatePetResponses[keyof CreatePetResponses];
+
+export type DeletePetData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/pets/{id}';
+};
+
+export type DeletePetErrors = {
+ /**
+ * Not found
+ */
+ 404: Error;
+};
+
+export type DeletePetError = DeletePetErrors[keyof DeletePetErrors];
+
+export type DeletePetResponses = {
+ /**
+ * Deleted
+ */
+ 204: void;
+};
+
+export type DeletePetResponse = DeletePetResponses[keyof DeletePetResponses];
+
+export type GetPetData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/pets/{id}';
+};
+
+export type GetPetErrors = {
+ /**
+ * Not found
+ */
+ 404: Error;
+};
+
+export type GetPetError = GetPetErrors[keyof GetPetErrors];
+
+export type GetPetResponses = {
+ /**
+ * A pet
+ */
+ 200: Pet;
+};
+
+export type GetPetResponse = GetPetResponses[keyof GetPetResponses];
+
+export type UpdatePetData = {
+ body: {
+ name: string;
+ tag?: Tag;
+ };
+ path: {
+ id: string;
+ };
+ query?: {
+ dryRun?: boolean;
+ };
+ url: '/pets/{id}';
+};
+
+export type UpdatePetResponses = {
+ /**
+ * Updated pet
+ */
+ 200: Pet;
+};
+
+export type UpdatePetResponse = UpdatePetResponses[keyof UpdatePetResponses];
+
+export type CreateJobData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/jobs';
+};
+
+export type CreateJobErrors = {
+ /**
+ * Client error
+ */
+ '4XX': Error;
+};
+
+export type CreateJobError = CreateJobErrors[keyof CreateJobErrors];
+
+export type CreateJobResponses = {
+ /**
+ * Job accepted
+ */
+ '2XX': Pet;
+};
+
+export type CreateJobResponse = CreateJobResponses[keyof CreateJobResponses];
+
+export type HealthCheckData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/health';
+};
+
+export type HealthCheckResponses = {
+ /**
+ * OK
+ */
+ 200: string;
+};
+
+export type HealthCheckResponse = HealthCheckResponses[keyof HealthCheckResponses];
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..dd1a61012f
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/@faker-js/faker.gen.ts
@@ -0,0 +1,512 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import { faker, type Faker } from '@faker-js/faker';
+
+import type { Active, Address, Animal, Anything, BoundedFloat, BoundedInt, Cat, Circle, Company, Config, CreateJobErrors, CreateJobResponses, CreatePetData, CreatePetResponse, DateOnly, DateTime, DefaultBool, DefaultInt, DefaultOverridesConstraints, DefaultString, DeletePetData, DeletePetErrors, DictionaryObject, Document, Dog, Email, EmailWithLength, Error, ExclusiveFloat, ExclusiveFloatNarrow, ExclusiveInt, GetPetData, GetPetErrors, GetPetResponses, HealthCheckResponse, IPv4Address, IPv6Address, ListPetsData, ListPetsResponse, MaxOnlyArray, MaxOnlyInt, MaxOnlyString, MinOnlyArray, MinOnlyNumber, MinOnlyString, NeverArray, Nothing, NullableInt, NullablePetOrTag, NullableString, NumericEnum, ObjectWithDefaultProp, ObjectWithOptionalNever, Person, PersonList, PersonProfile, PersonWithConstraints, Pet, PetList, PetOrTag, PetWithOwner, Price, Quantity, Shape, ShortName, Square, StatusWithNull, StringOrNumber, Tag, TagList, Tags, Team, UniqueId, UpdatePetData, UpdatePetResponse, User, UserProfile, Website, ZipCode } from '../types.gen';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakePrice = (options?: Options): Price => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeQuantity = (options?: Options): Quantity => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeActive = (options?: Options): Active => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeNothing = (): Nothing => null;
+
+export const fakeAnything = (): Anything => undefined;
+
+export const fakeStatusWithNull = (options?: Options): StatusWithNull => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'active',
+ 'inactive',
+ null
+ ]);
+};
+
+export const fakeNumericEnum = (options?: Options): NumericEnum => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3
+ ]);
+};
+
+export const fakeEmail = (options?: Options): Email => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeDateTime = (options?: Options): DateTime => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString();
+};
+
+export const fakeDateOnly = (options?: Options): DateOnly => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString().slice(0, 10);
+};
+
+export const fakeUniqueId = (options?: Options): UniqueId => {
+ const f = options?.faker ?? faker;
+ return f.string.uuid();
+};
+
+export const fakeWebsite = (options?: Options): Website => {
+ const f = options?.faker ?? faker;
+ return f.internet.url();
+};
+
+export const fakeIPv4Address = (options?: Options): IPv4Address => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv4();
+};
+
+export const fakeIPv6Address = (options?: Options): IPv6Address => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv6();
+};
+
+export const fakeZipCode = (options?: Options): ZipCode => {
+ const f = options?.faker ?? faker;
+ return f.helpers.fromRegExp('^\\d{5}(-\\d{4})?$');
+};
+
+export const fakeShortName = (options?: Options): ShortName => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 2, max: 50 } });
+};
+
+export const fakeMinOnlyString = (options?: Options): MinOnlyString => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 10, max: 100 } });
+};
+
+export const fakeMaxOnlyString = (options?: Options): MaxOnlyString => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 0, max: 5 } });
+};
+
+export const fakeEmailWithLength = (options?: Options): EmailWithLength => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeBoundedInt = (options?: Options): BoundedInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeBoundedFloat = (options?: Options): BoundedFloat => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveInt = (options?: Options): ExclusiveInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 9 });
+};
+
+export const fakeMinOnlyNumber = (options?: Options): MinOnlyNumber => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0 });
+};
+
+export const fakeMaxOnlyInt = (options?: Options): MaxOnlyInt => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ max: 999 });
+};
+
+export const fakeExclusiveFloat = (options?: Options): ExclusiveFloat => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveFloatNarrow = (options?: Options): ExclusiveFloatNarrow => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 10.1, max: 10.2 });
+};
+
+export const fakeTags = (options?: Options): Tags => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeTagList = (options?: Options): TagList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 1, max: 10 } });
+};
+
+export const fakeMinOnlyArray = (options?: Options): MinOnlyArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int(), { count: { min: 3, max: 100 } });
+};
+
+export const fakeMaxOnlyArray = (options?: Options): MaxOnlyArray => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 0, max: 5 } });
+};
+
+export const fakeDefaultString = (options?: Options): DefaultString => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 'unknown' : f.string.sample();
+};
+
+export const fakeDefaultInt = (options?: Options): DefaultInt => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int();
+};
+
+export const fakeDefaultBool = (options?: Options): DefaultBool => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean();
+};
+
+export const fakeDefaultOverridesConstraints = (options?: Options): DefaultOverridesConstraints => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 42 : f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeNullableString = (options?: Options): NullableString => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.string.sample() : null;
+};
+
+export const fakeNullableInt = (options?: Options): NullableInt => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.number.int() : null;
+};
+
+export const fakeObjectWithDefaultProp = (options?: Options): ObjectWithDefaultProp => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { status: resolveCondition(options?.useDefault ?? false, f) ? 'active' : f.string.sample() }
+ };
+};
+
+export const fakeDictionaryObject = (options?: Options): DictionaryObject => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.string.sample()
+ };
+};
+
+export const fakeUserProfile = (options?: Options): UserProfile => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bio: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) }
+ };
+};
+
+export const fakeTag = (options?: Options): Tag => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ label: f.string.sample()
+ };
+};
+
+export const fakePet = (options?: Options): Pet => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ };
+};
+
+export const fakeError = (options?: Options): Error => {
+ const f = options?.faker ?? faker;
+ return {
+ code: f.number.int(),
+ message: f.string.sample()
+ };
+};
+
+export const fakeAddress = (options?: Options): Address => {
+ const f = options?.faker ?? faker;
+ return {
+ street: f.location.streetAddress(),
+ zip: fakeZipCode(options)
+ };
+};
+
+export const fakePerson = (options?: Options): Person => {
+ const f = options?.faker ?? faker;
+ return {
+ name: fakeShortName(options),
+ email: fakeEmail(options),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { address: fakeAddress(options) }
+ };
+};
+
+export const fakePersonList = (options?: Options): PersonList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePerson(options), { count: { min: 1, max: 20 } });
+};
+
+export const fakePetList = (options?: Options): PetList => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeTeam = (options?: Options): Team => ({
+ lead: fakePerson(options),
+ config: fakeObjectWithDefaultProp(options)
+});
+
+export const fakePetOrTag = (options?: Options): PetOrTag => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([fakePet(options), fakeTag(options)]);
+};
+
+export const fakeStringOrNumber = (options?: Options): StringOrNumber => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([f.string.sample(), f.number.float()]);
+};
+
+export const fakeNullablePetOrTag = (options?: Options): NullablePetOrTag => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ fakePet(options),
+ fakeTag(options),
+ null
+ ]);
+};
+
+export const fakePetWithOwner = (options?: Options): PetWithOwner => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakePet(options), {
+ owner: f.string.sample()
+ });
+};
+
+export const fakeCircle = (options?: Options): Circle => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ radius: f.number.float()
+ };
+};
+
+export const fakeSquare = (options?: Options): Square => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ side: f.number.float()
+ };
+};
+
+export const fakeShape = (options?: Options): Shape => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeCircle(options)),
+ kind: 'Circle' as const
+ }, {
+ ...Object.assign({}, fakeSquare(options)),
+ kind: 'Square' as const
+ }]);
+};
+
+export const fakeDog = (options?: Options): Dog => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ bark: f.datatype.boolean()
+ };
+};
+
+export const fakeCat = (options?: Options): Cat => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ purr: f.datatype.boolean()
+ };
+};
+
+export const fakeAnimal = (options?: Options): Animal => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeDog(options)),
+ type: 'dog' as const
+ }, {
+ ...Object.assign({}, fakeCat(options)),
+ type: 'cat' as const
+ }]);
+};
+
+export const fakePersonProfile = (options?: Options): PersonProfile => {
+ const f = options?.faker ?? faker;
+ return {
+ firstName: f.person.firstName(),
+ last_name: f.person.lastName(),
+ email: f.internet.email(),
+ phone: f.phone.number(),
+ homePhone: f.phone.number(),
+ age: f.number.int({ max: 120, min: 1 }),
+ city: f.location.city(),
+ postalCode: f.location.zipCode(),
+ bio: f.lorem.sentence(),
+ website: f.internet.url(),
+ zipCode: f.helpers.fromRegExp('^\\d{5}$'),
+ username: f.internet.username(),
+ someRandomField: f.string.sample()
+ };
+};
+
+export const fakePersonWithConstraints = (options?: Options): PersonWithConstraints => {
+ const f = options?.faker ?? faker;
+ return {
+ age: f.number.int({ max: 120, min: 18 }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { seniorAge: f.number.int({ min: 65, max: 100 }) }
+ };
+};
+
+export const fakeUser = (options?: Options): User => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.person.fullName(),
+ email: f.internet.email()
+ };
+};
+
+export const fakeCompany = (options?: Options): Company => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.company.name()
+ };
+};
+
+export const fakeConfig = (options?: Options): Config => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample()
+ };
+};
+
+export const fakeNeverArray = (): NeverArray => [];
+
+export const fakeObjectWithOptionalNever = (options?: Options): ObjectWithOptionalNever => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int()
+ };
+};
+
+export const fakeDocument = (options?: Options): Document => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ _id: f.string.uuid(),
+ numericId: f.number.int()
+ };
+};
+
+export const fakeListPetsRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { limit: f.number.int({ min: 1, max: 100 }) }
+ }
+ };
+};
+
+export const fakeListPetsResponse = (options?: Options): ListPetsResponse => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeCreatePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCreatePetResponse = (options?: Options): CreatePetResponse => fakePet(options);
+
+export const fakeDeletePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeDeletePetResponse404 = (options?: Options): DeletePetErrors[404] => fakeError(options);
+
+export const fakeGetPetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeGetPetResponse200 = (options?: Options): GetPetResponses[200] => fakePet(options);
+
+export const fakeGetPetResponse404 = (options?: Options): GetPetErrors[404] => fakeError(options);
+
+export const fakeUpdatePetRequest = (options?: Options): Omit => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ },
+ path: {
+ id: f.string.uuid()
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dryRun: f.datatype.boolean() }
+ }
+ };
+};
+
+export const fakeUpdatePetResponse = (options?: Options): UpdatePetResponse => fakePet(options);
+
+export const fakeCreateJobResponse2Xx = (options?: Options): CreateJobResponses['2XX'] => fakePet(options);
+
+export const fakeCreateJobResponse4Xx = (options?: Options): CreateJobErrors['4XX'] => fakeError(options);
+
+export const fakeHealthCheckResponse = (options?: Options): HealthCheckResponse => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/index.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/index.ts
new file mode 100644
index 0000000000..0543fb7fba
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/index.ts
@@ -0,0 +1,3 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type { Active, Address, Animal, Anything, BoundedFloat, BoundedInt, Cat, Circle, ClientOptions, Company, Config, CreateJobData, CreateJobError, CreateJobErrors, CreateJobResponse, CreateJobResponses, CreatePetData, CreatePetResponse, CreatePetResponses, DateOnly, DateTime, DefaultBool, DefaultInt, DefaultOverridesConstraints, DefaultString, DeletePetData, DeletePetError, DeletePetErrors, DeletePetResponse, DeletePetResponses, DictionaryObject, Document, Dog, Email, EmailWithLength, Error, ExclusiveFloat, ExclusiveFloatNarrow, ExclusiveInt, GetPetData, GetPetError, GetPetErrors, GetPetResponse, GetPetResponses, HealthCheckData, HealthCheckResponse, HealthCheckResponses, IPv4Address, IPv6Address, ListPetsData, ListPetsResponse, ListPetsResponses, MaxOnlyArray, MaxOnlyInt, MaxOnlyString, MinOnlyArray, MinOnlyNumber, MinOnlyString, NeverArray, NeverTuple, Nothing, NullableInt, NullablePetOrTag, NullableString, NumericEnum, ObjectWithDefaultProp, ObjectWithOptionalNever, ObjectWithRequiredNever, Person, PersonList, PersonProfile, PersonWithConstraints, Pet, PetList, PetOrTag, PetWithOwner, Price, Quantity, Shape, ShortName, Square, StatusWithNull, StringOrNumber, Tag, TagList, Tags, Team, UniqueId, UpdatePetData, UpdatePetResponse, UpdatePetResponses, User, UserProfile, Website, ZipCode } from './types.gen';
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/types.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/types.gen.ts
new file mode 100644
index 0000000000..17825ee3ff
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker-typed/types.gen.ts
@@ -0,0 +1,391 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+export type ClientOptions = {
+ baseUrl: `${string}://${string}` | (string & {});
+};
+
+export type Price = number;
+
+export type Quantity = number;
+
+export type Active = boolean;
+
+export type Nothing = null;
+
+export type Anything = unknown;
+
+export type StatusWithNull = 'active' | 'inactive' | null;
+
+export type NumericEnum = 1 | 2 | 3;
+
+export type Email = string;
+
+export type DateTime = string;
+
+export type DateOnly = string;
+
+export type UniqueId = string;
+
+export type Website = string;
+
+export type IPv4Address = string;
+
+export type IPv6Address = string;
+
+export type ZipCode = string;
+
+export type ShortName = string;
+
+export type MinOnlyString = string;
+
+export type MaxOnlyString = string;
+
+export type EmailWithLength = string;
+
+export type BoundedInt = number;
+
+export type BoundedFloat = number;
+
+export type ExclusiveInt = number;
+
+export type MinOnlyNumber = number;
+
+export type MaxOnlyInt = number;
+
+export type ExclusiveFloat = number;
+
+export type ExclusiveFloatNarrow = number;
+
+export type Tags = Array;
+
+export type TagList = Array;
+
+export type MinOnlyArray = Array;
+
+export type MaxOnlyArray = Array;
+
+export type DefaultString = string;
+
+export type DefaultInt = number;
+
+export type DefaultBool = boolean;
+
+export type DefaultOverridesConstraints = number;
+
+export type NullableString = string | null;
+
+export type NullableInt = number | null;
+
+export type ObjectWithDefaultProp = {
+ name: string;
+ status?: string;
+};
+
+/**
+ * This is a dictionary object
+ */
+export type DictionaryObject = {
+ [key: string]: string;
+};
+
+export type UserProfile = {
+ id: number;
+ name: string;
+ bio?: string;
+ age?: number;
+};
+
+export type Pet = {
+ id: string;
+ name: string;
+ age?: number;
+ tag?: Tag;
+};
+
+export type Tag = {
+ id: number;
+ label: string;
+};
+
+export type Error = {
+ code: number;
+ message: string;
+};
+
+export type Address = {
+ street: string;
+ zip: ZipCode;
+};
+
+export type Person = {
+ name: ShortName;
+ email: Email;
+ address?: Address;
+};
+
+export type PersonList = Array;
+
+export type PetList = Array;
+
+export type Team = {
+ lead: Person;
+ config: ObjectWithDefaultProp;
+};
+
+export type PetOrTag = Pet | Tag;
+
+export type StringOrNumber = string | number;
+
+export type NullablePetOrTag = Pet | Tag | null;
+
+export type PetWithOwner = Pet & {
+ owner: string;
+};
+
+export type Circle = {
+ kind: string;
+ radius: number;
+};
+
+export type Square = {
+ kind: string;
+ side: number;
+};
+
+export type Shape = ({
+ kind: 'Circle';
+} & Circle) | ({
+ kind: 'Square';
+} & Square);
+
+export type Dog = {
+ type: string;
+ bark: boolean;
+};
+
+export type Cat = {
+ type: string;
+ purr: boolean;
+};
+
+export type Animal = ({
+ type: 'dog';
+} & Dog) | ({
+ type: 'cat';
+} & Cat);
+
+export type PersonProfile = {
+ firstName: string;
+ last_name: string;
+ email: string;
+ phone: string;
+ homePhone: string;
+ age: number;
+ city: string;
+ postalCode: string;
+ bio: string;
+ website: string;
+ zipCode: string;
+ username: string;
+ someRandomField: string;
+};
+
+export type PersonWithConstraints = {
+ age: number;
+ seniorAge?: number;
+};
+
+export type User = {
+ name: string;
+ email: string;
+};
+
+export type Company = {
+ name: string;
+};
+
+export type Config = {
+ name: string;
+};
+
+export type NeverTuple = [
+ number & string,
+ number & string
+];
+
+export type NeverArray = Array;
+
+export type ObjectWithRequiredNever = {
+ id: number;
+ impossible: number & string;
+};
+
+export type ObjectWithOptionalNever = {
+ id: number;
+ impossible?: number & string;
+};
+
+export type Document = {
+ id: string;
+ _id: string;
+ numericId: number;
+};
+
+export type ListPetsData = {
+ body?: never;
+ path?: never;
+ query?: {
+ limit?: number;
+ };
+ url: '/pets';
+};
+
+export type ListPetsResponses = {
+ /**
+ * A list of pets
+ */
+ 200: Array;
+};
+
+export type ListPetsResponse = ListPetsResponses[keyof ListPetsResponses];
+
+export type CreatePetData = {
+ body: {
+ name: string;
+ tag?: string;
+ };
+ path?: never;
+ query?: never;
+ url: '/pets';
+};
+
+export type CreatePetResponses = {
+ /**
+ * Pet created
+ */
+ 201: Pet;
+ /**
+ * No content
+ */
+ 204: void;
+};
+
+export type CreatePetResponse = CreatePetResponses[keyof CreatePetResponses];
+
+export type DeletePetData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/pets/{id}';
+};
+
+export type DeletePetErrors = {
+ /**
+ * Not found
+ */
+ 404: Error;
+};
+
+export type DeletePetError = DeletePetErrors[keyof DeletePetErrors];
+
+export type DeletePetResponses = {
+ /**
+ * Deleted
+ */
+ 204: void;
+};
+
+export type DeletePetResponse = DeletePetResponses[keyof DeletePetResponses];
+
+export type GetPetData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/pets/{id}';
+};
+
+export type GetPetErrors = {
+ /**
+ * Not found
+ */
+ 404: Error;
+};
+
+export type GetPetError = GetPetErrors[keyof GetPetErrors];
+
+export type GetPetResponses = {
+ /**
+ * A pet
+ */
+ 200: Pet;
+};
+
+export type GetPetResponse = GetPetResponses[keyof GetPetResponses];
+
+export type UpdatePetData = {
+ body: {
+ name: string;
+ tag?: Tag;
+ };
+ path: {
+ id: string;
+ };
+ query?: {
+ dryRun?: boolean;
+ };
+ url: '/pets/{id}';
+};
+
+export type UpdatePetResponses = {
+ /**
+ * Updated pet
+ */
+ 200: Pet;
+};
+
+export type UpdatePetResponse = UpdatePetResponses[keyof UpdatePetResponses];
+
+export type CreateJobData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/jobs';
+};
+
+export type CreateJobErrors = {
+ /**
+ * Client error
+ */
+ '4XX': Error;
+};
+
+export type CreateJobError = CreateJobErrors[keyof CreateJobErrors];
+
+export type CreateJobResponses = {
+ /**
+ * Job accepted
+ */
+ '2XX': Pet;
+};
+
+export type CreateJobResponse = CreateJobResponses[keyof CreateJobResponses];
+
+export type HealthCheckData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/health';
+};
+
+export type HealthCheckResponses = {
+ /**
+ * OK
+ */
+ 200: string;
+};
+
+export type HealthCheckResponse = HealthCheckResponses[keyof HealthCheckResponses];
diff --git a/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker/@faker-js/faker.gen.ts b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker/@faker-js/faker.gen.ts
new file mode 100644
index 0000000000..8b1b27b8aa
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/__snapshots__/3.1.x/faker/@faker-js/faker.gen.ts
@@ -0,0 +1,510 @@
+// This file is auto-generated by @hey-api/openapi-ts
+
+import { faker, type Faker } from '@faker-js/faker';
+
+export type Options = {
+ faker?: Faker;
+ /**
+ * Whether to include optional properties, including add property to record object.
+ * Provide a number between 0 and 1 to randomly include based on that probability.
+ * @default true
+ */
+ includeOptional?: boolean | number;
+ /**
+ * Whether to use schema default values instead of generating fake data.
+ * Provide a number between 0 and 1 to randomly use defaults based on that probability.
+ * @default false
+ */
+ useDefault?: boolean | number;
+};
+
+const resolveCondition = (condition: boolean | number, faker: Faker): boolean => condition === true || typeof condition === 'number' && faker.datatype.boolean({ probability: condition });
+
+export const fakePrice = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float();
+};
+
+export const fakeQuantity = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int();
+};
+
+export const fakeActive = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean();
+};
+
+export const fakeNothing = () => null;
+
+export const fakeAnything = () => undefined;
+
+export const fakeStatusWithNull = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 'active',
+ 'inactive',
+ null
+ ]);
+};
+
+export const fakeNumericEnum = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ 1,
+ 2,
+ 3
+ ]);
+};
+
+export const fakeEmail = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeDateTime = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString();
+};
+
+export const fakeDateOnly = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.date.recent().toISOString().slice(0, 10);
+};
+
+export const fakeUniqueId = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.uuid();
+};
+
+export const fakeWebsite = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.url();
+};
+
+export const fakeIPv4Address = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv4();
+};
+
+export const fakeIPv6Address = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.ipv6();
+};
+
+export const fakeZipCode = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.fromRegExp('^\\d{5}(-\\d{4})?$');
+};
+
+export const fakeShortName = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 2, max: 50 } });
+};
+
+export const fakeMinOnlyString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 10, max: 100 } });
+};
+
+export const fakeMaxOnlyString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.alpha({ length: { min: 0, max: 5 } });
+};
+
+export const fakeEmailWithLength = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.internet.email();
+};
+
+export const fakeBoundedInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeBoundedFloat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ min: 1, max: 9 });
+};
+
+export const fakeMinOnlyNumber = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0 });
+};
+
+export const fakeMaxOnlyInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.int({ max: 999 });
+};
+
+export const fakeExclusiveFloat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 0, max: 1 });
+};
+
+export const fakeExclusiveFloatNarrow = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.number.float({ min: 10.1, max: 10.2 });
+};
+
+export const fakeTags = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample());
+};
+
+export const fakeTagList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 1, max: 10 } });
+};
+
+export const fakeMinOnlyArray = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.number.int(), { count: { min: 3, max: 100 } });
+};
+
+export const fakeMaxOnlyArray = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => f.string.sample(), { count: { min: 0, max: 5 } });
+};
+
+export const fakeDefaultString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 'unknown' : f.string.sample();
+};
+
+export const fakeDefaultInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 0 : f.number.int();
+};
+
+export const fakeDefaultBool = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? true : f.datatype.boolean();
+};
+
+export const fakeDefaultOverridesConstraints = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return resolveCondition(options?.useDefault ?? false, f) ? 42 : f.number.int({ min: 1, max: 100 });
+};
+
+export const fakeNullableString = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.string.sample() : null;
+};
+
+export const fakeNullableInt = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.datatype.boolean() ? f.number.int() : null;
+};
+
+export const fakeObjectWithDefaultProp = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { status: resolveCondition(options?.useDefault ?? false, f) ? 'active' : f.string.sample() }
+ };
+};
+
+export const fakeDictionaryObject = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return !resolveCondition(options?.includeOptional ?? true, f) ? {} as {} : {
+ additionalProp: f.string.sample()
+ };
+};
+
+export const fakeUserProfile = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { bio: f.lorem.sentence() },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) }
+ };
+};
+
+export const fakeTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int(),
+ label: f.string.sample()
+ };
+};
+
+export const fakePet = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { age: f.number.int({ max: 120, min: 1 }) },
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ };
+};
+
+export const fakeError = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ code: f.number.int(),
+ message: f.string.sample()
+ };
+};
+
+export const fakeAddress = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ street: f.location.streetAddress(),
+ zip: fakeZipCode(options)
+ };
+};
+
+export const fakePerson = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: fakeShortName(options),
+ email: fakeEmail(options),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { address: fakeAddress(options) }
+ };
+};
+
+export const fakePersonList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePerson(options), { count: { min: 1, max: 20 } });
+};
+
+export const fakePetList = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeTeam = (options?: Options) => ({
+ lead: fakePerson(options),
+ config: fakeObjectWithDefaultProp(options)
+});
+
+export const fakePetOrTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([fakePet(options), fakeTag(options)]);
+};
+
+export const fakeStringOrNumber = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([f.string.sample(), f.number.float()]);
+};
+
+export const fakeNullablePetOrTag = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([
+ fakePet(options),
+ fakeTag(options),
+ null
+ ]);
+};
+
+export const fakePetWithOwner = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return Object.assign({}, fakePet(options), {
+ owner: f.string.sample()
+ });
+};
+
+export const fakeCircle = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ radius: f.number.float()
+ };
+};
+
+export const fakeSquare = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ kind: f.string.sample(),
+ side: f.number.float()
+ };
+};
+
+export const fakeShape = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeCircle(options)),
+ kind: 'Circle' as const
+ }, {
+ ...Object.assign({}, fakeSquare(options)),
+ kind: 'Square' as const
+ }]);
+};
+
+export const fakeDog = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ bark: f.datatype.boolean()
+ };
+};
+
+export const fakeCat = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ type: f.string.sample(),
+ purr: f.datatype.boolean()
+ };
+};
+
+export const fakeAnimal = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.arrayElement([{
+ ...Object.assign({}, fakeDog(options)),
+ type: 'dog' as const
+ }, {
+ ...Object.assign({}, fakeCat(options)),
+ type: 'cat' as const
+ }]);
+};
+
+export const fakePersonProfile = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ firstName: f.person.firstName(),
+ last_name: f.person.lastName(),
+ email: f.internet.email(),
+ phone: f.phone.number(),
+ homePhone: f.phone.number(),
+ age: f.number.int({ max: 120, min: 1 }),
+ city: f.location.city(),
+ postalCode: f.location.zipCode(),
+ bio: f.lorem.sentence(),
+ website: f.internet.url(),
+ zipCode: f.helpers.fromRegExp('^\\d{5}$'),
+ username: f.internet.username(),
+ someRandomField: f.string.sample()
+ };
+};
+
+export const fakePersonWithConstraints = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ age: f.number.int({ max: 120, min: 18 }),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { seniorAge: f.number.int({ min: 65, max: 100 }) }
+ };
+};
+
+export const fakeUser = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.person.fullName(),
+ email: f.internet.email()
+ };
+};
+
+export const fakeCompany = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.company.name()
+ };
+};
+
+export const fakeConfig = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ name: f.string.sample()
+ };
+};
+
+export const fakeNeverArray = () => [];
+
+export const fakeObjectWithOptionalNever = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.number.int()
+ };
+};
+
+export const fakeDocument = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ id: f.string.uuid(),
+ _id: f.string.uuid(),
+ numericId: f.number.int()
+ };
+};
+
+export const fakeListPetsRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { limit: f.number.int({ min: 1, max: 100 }) }
+ }
+ };
+};
+
+export const fakeListPetsResponse = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.helpers.multiple(() => fakePet(options));
+};
+
+export const fakeCreatePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: f.string.sample() }
+ }
+ };
+};
+
+export const fakeCreatePetResponse = (options?: Options) => fakePet(options);
+
+export const fakeDeletePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeDeletePetResponse404 = (options?: Options) => fakeError(options);
+
+export const fakeGetPetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ path: {
+ id: f.string.uuid()
+ }
+ };
+};
+
+export const fakeGetPetResponse200 = (options?: Options) => fakePet(options);
+
+export const fakeGetPetResponse404 = (options?: Options) => fakeError(options);
+
+export const fakeUpdatePetRequest = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return {
+ body: {
+ name: f.string.sample(),
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { tag: fakeTag(options) }
+ },
+ path: {
+ id: f.string.uuid()
+ },
+ query: {
+ ...!resolveCondition(options?.includeOptional ?? true, f) ? {} : { dryRun: f.datatype.boolean() }
+ }
+ };
+};
+
+export const fakeUpdatePetResponse = (options?: Options) => fakePet(options);
+
+export const fakeCreateJobResponse2Xx = (options?: Options) => fakePet(options);
+
+export const fakeCreateJobResponse4Xx = (options?: Options) => fakeError(options);
+
+export const fakeHealthCheckResponse = (options?: Options) => {
+ const f = options?.faker ?? faker;
+ return f.string.sample();
+};
diff --git a/packages/openapi-ts-tests/faker/v10/package.json b/packages/openapi-ts-tests/faker/v10/package.json
new file mode 100644
index 0000000000..8daba95fc0
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "@test/openapi-ts-faker-v10",
+ "version": "0.0.0",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "typecheck": "tsgo --noEmit"
+ },
+ "devDependencies": {
+ "@faker-js/faker": "^10.4.0",
+ "@hey-api/openapi-ts": "workspace:*",
+ "typescript": "5.9.3"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+}
diff --git a/packages/openapi-ts-tests/faker/v10/test/constants.ts b/packages/openapi-ts-tests/faker/v10/test/constants.ts
new file mode 100644
index 0000000000..e72988d8bb
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/test/constants.ts
@@ -0,0 +1,4 @@
+import path from 'node:path';
+
+export const snapshotsDir = path.join(__dirname, '..', '__snapshots__');
+export const tmpDir = path.join(__dirname, '..', '.tmp');
diff --git a/packages/openapi-ts-tests/faker/v10/test/faker.test.ts b/packages/openapi-ts-tests/faker/v10/test/faker.test.ts
new file mode 100644
index 0000000000..7735e8e0fd
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/test/faker.test.ts
@@ -0,0 +1,98 @@
+import fs from 'node:fs';
+import path from 'node:path';
+
+import { createClient } from '@hey-api/openapi-ts';
+
+import { getFilePaths } from '../../../utils';
+import { snapshotsDir, tmpDir } from './constants';
+import { createConfigFactory } from './utils';
+
+const versions = ['2.0.x', '3.0.x', '3.1.x'] as const;
+
+describe.each(versions)('OpenAPI %s', (version) => {
+ const outputDir = path.join(tmpDir, version);
+ const createConfig = createConfigFactory({ openApiVersion: version, outputDir });
+
+ const scenarios = [
+ {
+ config: createConfig({
+ input: 'faker.yaml',
+ output: 'faker',
+ }),
+ description: 'generates faker factories without type annotations',
+ },
+ {
+ config: createConfig({
+ input: 'faker.yaml',
+ output: 'faker-locale',
+ plugins: [{ locale: 'de', name: '@faker-js/faker' }],
+ }),
+ description: 'generates faker factories with locale-specific import',
+ },
+ {
+ config: createConfig({
+ input: 'faker.yaml',
+ output: 'faker-typed',
+ plugins: ['@hey-api/typescript', '@faker-js/faker'],
+ }),
+ description: 'generates typed faker factories when typescript plugin is active',
+ },
+ {
+ config: createConfig({
+ input: 'circular.yaml',
+ output: 'faker-circular',
+ plugins: ['@hey-api/typescript', '@faker-js/faker'],
+ }),
+ description: 'generates faker factories with schemas with circular references',
+ },
+ {
+ config: createConfig({
+ input: 'faker.yaml',
+ output: 'faker-name-rules',
+ plugins: [
+ '@hey-api/typescript',
+ {
+ name: '@faker-js/faker',
+ nameRules: {
+ string: {
+ 'error.message': {
+ defaultArgs: { count: 4 },
+ fakerPath: ['word', 'words'],
+ },
+ id: {
+ fakerPath: ['database', 'mongodbObjectId'],
+ suffixMatch: true,
+ },
+ },
+ },
+ },
+ ],
+ }),
+ description: 'generates faker factories with name rules',
+ },
+ {
+ config: createConfig({
+ input: 'full.yaml',
+ output: 'faker-full',
+ plugins: ['@hey-api/typescript', { compatibilityVersion: 9, name: '@faker-js/faker' }],
+ }),
+ description: 'generates faker factories',
+ },
+ ];
+
+ it.each(scenarios)('$description', async ({ config }) => {
+ await createClient(config);
+
+ const outputString = config.output as string;
+ const filePaths = getFilePaths(outputString);
+
+ await Promise.all(
+ filePaths.map(async (filePath) => {
+ const fileContent = fs.readFileSync(filePath, 'utf-8');
+ await expect(fileContent).toMatchFileSnapshot(
+ path.join(snapshotsDir, version, filePath.slice(outputDir.length + 1)),
+ );
+ }),
+ );
+ });
+});
diff --git a/packages/openapi-ts-tests/faker/v10/test/globalTeardown.ts b/packages/openapi-ts-tests/faker/v10/test/globalTeardown.ts
new file mode 100644
index 0000000000..7c8712f70f
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/test/globalTeardown.ts
@@ -0,0 +1,7 @@
+import fs from 'node:fs';
+
+import { tmpDir } from './constants';
+
+export function teardown() {
+ fs.rmSync(tmpDir, { force: true, recursive: true });
+}
diff --git a/packages/openapi-ts-tests/faker/v10/test/utils.ts b/packages/openapi-ts-tests/faker/v10/test/utils.ts
new file mode 100644
index 0000000000..3a9e9530cc
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/test/utils.ts
@@ -0,0 +1,37 @@
+import path from 'node:path';
+
+import type { UserConfig } from '@hey-api/openapi-ts';
+
+import { getSpecsPath } from '../../../utils';
+
+export function createConfigFactory({
+ openApiVersion,
+ outputDir,
+}: {
+ openApiVersion: string;
+ outputDir: string;
+}) {
+ return (userConfig: UserConfig) => {
+ const input = userConfig.input instanceof Array ? userConfig.input[0]! : userConfig.input;
+ const inputPath = path.join(
+ getSpecsPath(),
+ openApiVersion,
+ typeof input === 'string' ? input : (input.path as string),
+ );
+ const output = userConfig.output instanceof Array ? userConfig.output[0]! : userConfig.output;
+ const outputPath = typeof output === 'string' ? output : (output?.path ?? '');
+ return {
+ plugins: ['@faker-js/faker'],
+ ...userConfig,
+ input:
+ typeof userConfig.input === 'string'
+ ? inputPath
+ : {
+ ...userConfig.input,
+ path: inputPath,
+ },
+ logs: { level: 'silent', path: './logs' },
+ output: path.join(outputDir, outputPath),
+ } as UserConfig;
+ };
+}
diff --git a/packages/openapi-ts-tests/faker/v10/tsconfig.json b/packages/openapi-ts-tests/faker/v10/tsconfig.json
new file mode 100644
index 0000000000..e7572df83d
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "extends": "../../tsconfig.base.json",
+ "include": ["test/**/*", "__snapshots__/**/*"],
+ "references": [{ "path": "../../../openapi-ts" }]
+}
diff --git a/packages/openapi-ts-tests/faker/v10/turbo.json b/packages/openapi-ts-tests/faker/v10/turbo.json
new file mode 100644
index 0000000000..f25a4152d3
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/turbo.json
@@ -0,0 +1,10 @@
+{
+ "$schema": "../../../../node_modules/turbo/schema.json",
+ "extends": ["//"],
+ "tasks": {
+ "build": {
+ "dependsOn": [],
+ "outputs": ["dist/**"]
+ }
+ }
+}
diff --git a/packages/openapi-ts-tests/faker/v10/vitest.setup.ts b/packages/openapi-ts-tests/faker/v10/vitest.setup.ts
new file mode 100644
index 0000000000..c6178ba405
--- /dev/null
+++ b/packages/openapi-ts-tests/faker/v10/vitest.setup.ts
@@ -0,0 +1,7 @@
+import { fileURLToPath } from 'node:url';
+
+import { beforeAll } from 'vitest';
+
+beforeAll(() => {
+ process.chdir(fileURLToPath(new URL('.', import.meta.url)));
+});
diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/circular/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/circular/zod.gen.ts
index a6c351d2d5..5684171a21 100644
--- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/circular/zod.gen.ts
+++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/circular/zod.gen.ts
@@ -2,6 +2,23 @@
import * as z from 'zod/v4-mini';
+export const zTreeNode = z.object({
+ id: z.string(),
+ value: z.string(),
+ children: z.optional(z.array(z.lazy((): any => zTreeNode)))
+});
+
+export const zWrapper = z.object({
+ label: z.string(),
+ tree: zTreeNode
+});
+
+export const zComment = z.object({
+ id: z.string(),
+ text: z.string(),
+ parent: z.nullable(z.lazy((): any => zComment))
+});
+
export const zFoo = z.object({
quux: z.optional(z.lazy((): any => zQuux))
});
@@ -31,3 +48,33 @@ export const zQuux = z.object({
export const zCorge = z.object({
baz: z.optional(z.array(zBaz))
});
+
+export const zOrg = z.object({
+ id: z.string(),
+ name: z.string(),
+ members: z.optional(z.array(z.lazy((): any => zMember)))
+});
+
+export const zMember = z.object({
+ id: z.string(),
+ name: z.string(),
+ org: z.optional(zOrg)
+});
+
+export const zDepartment = z.object({
+ id: z.string(),
+ name: z.string(),
+ employees: z.optional(z.array(z.lazy((): any => zEmployee)))
+});
+
+export const zEmployee = z.object({
+ id: z.string(),
+ name: z.string(),
+ projects: z.array(z.lazy((): any => zProject))
+});
+
+export const zProject = z.object({
+ id: z.string(),
+ name: z.string(),
+ department: z.optional(zDepartment)
+});
diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/circular/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/circular/zod.gen.ts
index 4caa3fbd4e..9d4261c7f9 100644
--- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/circular/zod.gen.ts
+++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/circular/zod.gen.ts
@@ -2,6 +2,23 @@
import { z } from 'zod';
+export const zTreeNode: z.AnyZodObject = z.object({
+ id: z.string(),
+ value: z.string(),
+ children: z.array(z.lazy(() => zTreeNode)).optional()
+});
+
+export const zWrapper = z.object({
+ label: z.string(),
+ tree: zTreeNode
+});
+
+export const zComment: z.AnyZodObject = z.object({
+ id: z.string(),
+ text: z.string(),
+ parent: z.lazy(() => zComment).nullable()
+});
+
export const zFoo: z.AnyZodObject = z.object({
quux: z.lazy(() => zQuux).optional()
});
@@ -31,3 +48,33 @@ export const zQuux = z.object({
export const zCorge = z.object({
baz: z.array(zBaz).optional()
});
+
+export const zOrg: z.AnyZodObject = z.object({
+ id: z.string(),
+ name: z.string(),
+ members: z.array(z.lazy(() => zMember)).optional()
+});
+
+export const zMember = z.object({
+ id: z.string(),
+ name: z.string(),
+ org: zOrg.optional()
+});
+
+export const zDepartment: z.AnyZodObject = z.object({
+ id: z.string(),
+ name: z.string(),
+ employees: z.array(z.lazy(() => zEmployee)).optional()
+});
+
+export const zEmployee: z.AnyZodObject = z.object({
+ id: z.string(),
+ name: z.string(),
+ projects: z.array(z.lazy(() => zProject))
+});
+
+export const zProject = z.object({
+ id: z.string(),
+ name: z.string(),
+ department: zDepartment.optional()
+});
diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/circular/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/circular/zod.gen.ts
index f17d721509..5355958677 100644
--- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/circular/zod.gen.ts
+++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/circular/zod.gen.ts
@@ -2,6 +2,23 @@
import * as z from 'zod/v4';
+export const zTreeNode = z.object({
+ id: z.string(),
+ value: z.string(),
+ children: z.array(z.lazy((): any => zTreeNode)).optional()
+});
+
+export const zWrapper = z.object({
+ label: z.string(),
+ tree: zTreeNode
+});
+
+export const zComment = z.object({
+ id: z.string(),
+ text: z.string(),
+ parent: z.lazy((): any => zComment).nullable()
+});
+
export const zFoo = z.object({
quux: z.lazy((): any => zQuux).optional()
});
@@ -31,3 +48,33 @@ export const zQuux = z.object({
export const zCorge = z.object({
baz: z.array(zBaz).optional()
});
+
+export const zOrg = z.object({
+ id: z.string(),
+ name: z.string(),
+ members: z.array(z.lazy((): any => zMember)).optional()
+});
+
+export const zMember = z.object({
+ id: z.string(),
+ name: z.string(),
+ org: zOrg.optional()
+});
+
+export const zDepartment = z.object({
+ id: z.string(),
+ name: z.string(),
+ employees: z.array(z.lazy((): any => zEmployee)).optional()
+});
+
+export const zEmployee = z.object({
+ id: z.string(),
+ name: z.string(),
+ projects: z.array(z.lazy((): any => zProject))
+});
+
+export const zProject = z.object({
+ id: z.string(),
+ name: z.string(),
+ department: zDepartment.optional()
+});
diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/circular/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/circular/zod.gen.ts
index c9bffc9233..1cd37f838f 100644
--- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/circular/zod.gen.ts
+++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/circular/zod.gen.ts
@@ -2,6 +2,23 @@
import * as z from 'zod/mini';
+export const zTreeNode = z.object({
+ id: z.string(),
+ value: z.string(),
+ children: z.optional(z.array(z.lazy((): any => zTreeNode)))
+});
+
+export const zWrapper = z.object({
+ label: z.string(),
+ tree: zTreeNode
+});
+
+export const zComment = z.object({
+ id: z.string(),
+ text: z.string(),
+ parent: z.nullable(z.lazy((): any => zComment))
+});
+
export const zFoo = z.object({
quux: z.optional(z.lazy((): any => zQuux))
});
@@ -31,3 +48,33 @@ export const zQuux = z.object({
export const zCorge = z.object({
baz: z.optional(z.array(zBaz))
});
+
+export const zOrg = z.object({
+ id: z.string(),
+ name: z.string(),
+ members: z.optional(z.array(z.lazy((): any => zMember)))
+});
+
+export const zMember = z.object({
+ id: z.string(),
+ name: z.string(),
+ org: z.optional(zOrg)
+});
+
+export const zDepartment = z.object({
+ id: z.string(),
+ name: z.string(),
+ employees: z.optional(z.array(z.lazy((): any => zEmployee)))
+});
+
+export const zEmployee = z.object({
+ id: z.string(),
+ name: z.string(),
+ projects: z.array(z.lazy((): any => zProject))
+});
+
+export const zProject = z.object({
+ id: z.string(),
+ name: z.string(),
+ department: z.optional(zDepartment)
+});
diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/circular/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/circular/zod.gen.ts
index 89c43bbd9d..98964d2027 100644
--- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/circular/zod.gen.ts
+++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/circular/zod.gen.ts
@@ -2,6 +2,23 @@
import { z } from 'zod/v3';
+export const zTreeNode: z.AnyZodObject = z.object({
+ id: z.string(),
+ value: z.string(),
+ children: z.array(z.lazy(() => zTreeNode)).optional()
+});
+
+export const zWrapper = z.object({
+ label: z.string(),
+ tree: zTreeNode
+});
+
+export const zComment: z.AnyZodObject = z.object({
+ id: z.string(),
+ text: z.string(),
+ parent: z.lazy(() => zComment).nullable()
+});
+
export const zFoo: z.AnyZodObject = z.object({
quux: z.lazy(() => zQuux).optional()
});
@@ -31,3 +48,33 @@ export const zQuux = z.object({
export const zCorge = z.object({
baz: z.array(zBaz).optional()
});
+
+export const zOrg: z.AnyZodObject = z.object({
+ id: z.string(),
+ name: z.string(),
+ members: z.array(z.lazy(() => zMember)).optional()
+});
+
+export const zMember = z.object({
+ id: z.string(),
+ name: z.string(),
+ org: zOrg.optional()
+});
+
+export const zDepartment: z.AnyZodObject = z.object({
+ id: z.string(),
+ name: z.string(),
+ employees: z.array(z.lazy(() => zEmployee)).optional()
+});
+
+export const zEmployee: z.AnyZodObject = z.object({
+ id: z.string(),
+ name: z.string(),
+ projects: z.array(z.lazy(() => zProject))
+});
+
+export const zProject = z.object({
+ id: z.string(),
+ name: z.string(),
+ department: zDepartment.optional()
+});
diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/circular/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/circular/zod.gen.ts
index 6fdddaf323..6f2e3f0f1b 100644
--- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/circular/zod.gen.ts
+++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/circular/zod.gen.ts
@@ -2,6 +2,23 @@
import * as z from 'zod';
+export const zTreeNode = z.object({
+ id: z.string(),
+ value: z.string(),
+ children: z.array(z.lazy((): any => zTreeNode)).optional()
+});
+
+export const zWrapper = z.object({
+ label: z.string(),
+ tree: zTreeNode
+});
+
+export const zComment = z.object({
+ id: z.string(),
+ text: z.string(),
+ parent: z.lazy((): any => zComment).nullable()
+});
+
export const zFoo = z.object({
quux: z.lazy((): any => zQuux).optional()
});
@@ -31,3 +48,33 @@ export const zQuux = z.object({
export const zCorge = z.object({
baz: z.array(zBaz).optional()
});
+
+export const zOrg = z.object({
+ id: z.string(),
+ name: z.string(),
+ members: z.array(z.lazy((): any => zMember)).optional()
+});
+
+export const zMember = z.object({
+ id: z.string(),
+ name: z.string(),
+ org: zOrg.optional()
+});
+
+export const zDepartment = z.object({
+ id: z.string(),
+ name: z.string(),
+ employees: z.array(z.lazy((): any => zEmployee)).optional()
+});
+
+export const zEmployee = z.object({
+ id: z.string(),
+ name: z.string(),
+ projects: z.array(z.lazy((): any => zProject))
+});
+
+export const zProject = z.object({
+ id: z.string(),
+ name: z.string(),
+ department: zDepartment.optional()
+});
diff --git a/packages/openapi-ts/src/plugins/@faker-js/faker/api.ts b/packages/openapi-ts/src/plugins/@faker-js/faker/api.ts
index 5c568d68c3..eac357bf1a 100644
--- a/packages/openapi-ts/src/plugins/@faker-js/faker/api.ts
+++ b/packages/openapi-ts/src/plugins/@faker-js/faker/api.ts
@@ -1,45 +1,61 @@
import type { IR } from '@hey-api/shared';
-import type { $ } from '../../../ts-dsl';
-
-type Expression = ReturnType;
+import type { Expression } from './shared/types';
+import type { FakerJsFakerPlugin } from './types';
+import { toNodeRefV10, toNodeV10 } from './v10/api';
export type IApi = {
/**
- * Generate a Faker expression for a schema.
+ * Generate an inline Faker expression for a schema.
*
* Returns an expression that produces a valid instance when executed.
- * Use when you need one-off generation without referencing shared artifacts.
+ * The returned expression may reference faker symbols (`ensureFaker`,
+ * `options`) — cross-plugin references resolve imports automatically.
*
* @example
* ```ts
+ * // For { type: 'object', properties: { name: string, email: string } }:
* {
- * name: faker.person.fullName(),
- * email: faker.internet.email()
+ * name: ensureFaker(options).person.fullName(),
+ * email: ensureFaker(options).internet.email()
* }
* ```
*/
- toNode(schema: IR.SchemaObject): Expression;
+ toNode(args: { plugin: FakerJsFakerPlugin['Instance']; schema: IR.SchemaObject }): Expression;
/**
- * Get a reference to a generated Faker expression for a schema.
+ * Get a reference to an existing Faker factory for a schema.
*
- * Returns a call expression referencing the shared artifact.
- * If the artifact doesn't exist, it will be created.
+ * For `$ref` schemas, looks up the registered factory symbol via
+ * `referenceSymbol` and returns a call expression (e.g. `fakeUser(options)`).
+ * For non-`$ref` schemas, falls back to an inline expression via `toNode`.
*
* @example
- * // Returns: fakeUser()
+ * ```ts
+ * // For { $ref: '#/components/schemas/User' }:
+ * fakeUser(options)
+ * ```
*/
- toNodeRef(schema: IR.SchemaObject): Expression;
+ toNodeRef(args: { plugin: FakerJsFakerPlugin['Instance']; schema: IR.SchemaObject }): Expression;
};
export class Api implements IApi {
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- toNode(_schema: IR.SchemaObject): Expression {
- return undefined as any;
+ toNode(args: { plugin: FakerJsFakerPlugin['Instance']; schema: IR.SchemaObject }): Expression {
+ const { plugin } = args;
+ switch (plugin.config.compatibilityVersion) {
+ case 9:
+ case 10:
+ default:
+ return toNodeV10(args);
+ }
}
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- toNodeRef(_schema: IR.SchemaObject): Expression {
- return undefined as any;
+ toNodeRef(args: { plugin: FakerJsFakerPlugin['Instance']; schema: IR.SchemaObject }): Expression {
+ const { plugin } = args;
+ switch (plugin.config.compatibilityVersion) {
+ case 9:
+ case 10:
+ default:
+ return toNodeRefV10(args);
+ }
}
}
diff --git a/packages/openapi-ts/src/plugins/@faker-js/faker/config.ts b/packages/openapi-ts/src/plugins/@faker-js/faker/config.ts
index 50ba6576a8..4767d61c30 100644
--- a/packages/openapi-ts/src/plugins/@faker-js/faker/config.ts
+++ b/packages/openapi-ts/src/plugins/@faker-js/faker/config.ts
@@ -1,7 +1,7 @@
import { definePluginConfig, mappers } from '@hey-api/shared';
import { Api } from './api';
-// import { handler } from './plugin';
+import { handler } from './plugin';
import type { FakerJsFakerPlugin } from './types';
export const defaultConfig: FakerJsFakerPlugin['Config'] = {
@@ -9,20 +9,48 @@ export const defaultConfig: FakerJsFakerPlugin['Config'] = {
config: {
case: 'camelCase',
includeInEntry: false,
+ nameRules: {},
},
- // handler,
- handler: () => {},
+ handler,
name: '@faker-js/faker',
resolveConfig: (plugin, context) => {
+ if (!plugin.config.compatibilityVersion) {
+ const version = context.package.getVersion('@faker-js/faker');
+ plugin.config.compatibilityVersion =
+ version && (version.major === 9 || version.major === 10) ? (version.major as 9 | 10) : 9;
+ }
+
+ plugin.config.maxCallDepth = plugin.config.maxCallDepth ?? 10;
+
plugin.config.definitions = context.valueToObject({
defaultValue: {
case: plugin.config.case ?? 'camelCase',
enabled: true,
- name: 'v{{name}}',
+ name: 'fake{{name}}',
},
mappers,
value: plugin.config.definitions,
});
+
+ plugin.config.requests = context.valueToObject({
+ defaultValue: {
+ case: plugin.config.case ?? 'camelCase',
+ enabled: true,
+ name: 'fake{{name}}Request',
+ },
+ mappers,
+ value: plugin.config.requests,
+ });
+
+ plugin.config.responses = context.valueToObject({
+ defaultValue: {
+ case: plugin.config.case ?? 'camelCase',
+ enabled: true,
+ name: 'fake{{name}}Response',
+ },
+ mappers,
+ value: plugin.config.responses,
+ });
},
tags: ['mocker'],
};
diff --git a/packages/openapi-ts/src/plugins/@faker-js/faker/plugin.ts b/packages/openapi-ts/src/plugins/@faker-js/faker/plugin.ts
new file mode 100644
index 0000000000..d9c3c2f581
--- /dev/null
+++ b/packages/openapi-ts/src/plugins/@faker-js/faker/plugin.ts
@@ -0,0 +1,12 @@
+import type { FakerJsFakerPlugin } from './types';
+import { handlerV10 } from './v10/plugin';
+
+export const handler: FakerJsFakerPlugin['Handler'] = (args) => {
+ const { plugin } = args;
+ switch (plugin.config.compatibilityVersion) {
+ case 9:
+ case 10:
+ default:
+ return handlerV10(args);
+ }
+};
diff --git a/packages/openapi-ts/src/plugins/@faker-js/faker/shared/export.ts b/packages/openapi-ts/src/plugins/@faker-js/faker/shared/export.ts
new file mode 100644
index 0000000000..84c1553524
--- /dev/null
+++ b/packages/openapi-ts/src/plugins/@faker-js/faker/shared/export.ts
@@ -0,0 +1,84 @@
+import { log } from '@hey-api/codegen-core';
+import { buildSymbolIn, pathToName } from '@hey-api/shared';
+
+import { $ } from '../../../../ts-dsl';
+import { getFakerPackagePath } from './helpers';
+import type { ProcessorContext } from './processor';
+import type { FakerResult } from './types';
+
+export function exportAst({
+ final,
+ isCircularSchema,
+ meta,
+ naming,
+ namingAnchor,
+ path,
+ plugin,
+ schema,
+ tags,
+}: ProcessorContext & {
+ final: FakerResult;
+ isCircularSchema?: boolean;
+}): void {
+ const name = pathToName(path, { anchor: namingAnchor });
+ const symbolIn = buildSymbolIn({
+ meta: {
+ category: 'schema',
+ path,
+ tags,
+ tool: 'faker',
+ ...meta,
+ },
+ name,
+ naming,
+ plugin,
+ schema,
+ });
+
+ if (final.resultType === 'never') {
+ log.warn(
+ `[${plugin.name}] ${symbolIn.name} not generated because we can't produce data that fits its schema.`,
+ );
+ return;
+ }
+
+ const symbol = plugin.registerSymbol(symbolIn);
+
+ // Look up the TypeScript type for this schema (e.g. Foo, Bar, or PostFooResponse)
+ const typeSymbol = plugin.querySymbol({
+ category: 'type',
+ resource: meta.resource,
+ resourceId: meta.resourceId,
+ tool: 'typescript',
+ ...(meta.role ? { role: meta.role } : undefined),
+ });
+
+ // Build arrow function, only adding options param when the expression uses faker.
+ // When usesAccessor is true, emit a block body: const f = options?.faker ?? faker; return ;
+ const arrowFn = $.func()
+ .arrow()
+ .$if(final.usesFaker, (f) => {
+ if (isCircularSchema) {
+ return f
+ .param('options', (p) => p.type('Options').assign($.object()))
+ .param('_callDepth', (p) => p.assign($.literal(0)));
+ }
+ return f.param('options', (p) => p.optional().type('Options'));
+ })
+ .$if(typeSymbol, (f) => f.returns($.type(typeSymbol!)))
+ .$if(
+ final.usesAccessor,
+ (f) => {
+ const fakerSymbol = plugin.external(`${getFakerPackagePath(plugin.config.locale)}.faker`);
+ const fDecl = $.const('f').assign(
+ $.binary($('options').attr('faker').optional(), '??', $(fakerSymbol)),
+ );
+ return f.do(fDecl, $.return(final.expression));
+ },
+ (f) => f.do($.return(final.expression)),
+ );
+
+ const statement = $.const(symbol).export().assign(arrowFn);
+
+ plugin.node(statement);
+}
diff --git a/packages/openapi-ts/src/plugins/@faker-js/faker/shared/faker-expr.ts b/packages/openapi-ts/src/plugins/@faker-js/faker/shared/faker-expr.ts
new file mode 100644
index 0000000000..69441d8942
--- /dev/null
+++ b/packages/openapi-ts/src/plugins/@faker-js/faker/shared/faker-expr.ts
@@ -0,0 +1,66 @@
+import { $ } from '../../../../ts-dsl';
+import { normalizeName } from './helpers';
+import type {
+ EmitTracking,
+ FakerWalkerContext,
+ NameRule,
+ NameRulesOverrides,
+ ResolvedNameRules,
+} from './types';
+
+/**
+ * Creates the shared walker context with the faker accessor expression.
+ *
+ * The accessor is `f` — a local variable declared in each function body
+ * as `const f = options?.faker ?? faker`.
+ */
+export function createFakerWalkerContext(
+ tracking: EmitTracking,
+ circularPointers: Set,
+ isCircularSchema: boolean,
+ nameRules:
+ | {
+ number?: NameRulesOverrides;
+ string?: NameRulesOverrides;
+ }
+ | undefined,
+): FakerWalkerContext {
+ const optionsId = $('options');
+ const fakerAccessor = $('f');
+
+ return {
+ circularPointers,
+ fakerAccessor,
+ isCircularSchema,
+ nameRulesByType: {
+ number: nameRules?.number && mapRules(nameRules.number),
+ string: nameRules?.string && mapRules(nameRules.string),
+ },
+ optionsId,
+ tracking,
+ };
+}
+
+function mapRules(overrides: NameRulesOverrides): ResolvedNameRules {
+ const compoundRules: Record = {};
+ const exactMatchRules: Record = {};
+ const suffixRules: Array<{ rule: NameRule; suffix: string }> = [];
+
+ Object.entries(overrides).forEach(([key, { suffixMatch, ...rule }]) => {
+ if (key.includes('.')) {
+ compoundRules[normalizeName(key)] = rule;
+ } else if (suffixMatch) {
+ suffixRules.push({
+ rule,
+ suffix: normalizeName(key),
+ });
+ } else {
+ exactMatchRules[normalizeName(key)] = rule;
+ }
+ });
+ return {
+ ...(Object.keys(compoundRules).length > 0 ? { compoundRules } : {}),
+ ...(Object.keys(exactMatchRules).length > 0 ? { exactMatchRules } : {}),
+ ...(suffixRules.length > 0 ? { suffixRules } : {}),
+ };
+}
diff --git a/packages/openapi-ts/src/plugins/@faker-js/faker/shared/helpers.ts b/packages/openapi-ts/src/plugins/@faker-js/faker/shared/helpers.ts
new file mode 100644
index 0000000000..3a6bbafba5
--- /dev/null
+++ b/packages/openapi-ts/src/plugins/@faker-js/faker/shared/helpers.ts
@@ -0,0 +1,5 @@
+/** Strip underscores/hyphens and lowercase for case-insensitive matching. */
+export const normalizeName = (name: string) => name.replace(/[-_]/g, '').toLowerCase();
+
+export const getFakerPackagePath = (maybeLocale: string | undefined) =>
+ maybeLocale ? `@faker-js/faker/locale/${maybeLocale}` : '@faker-js/faker';
diff --git a/packages/openapi-ts/src/plugins/@faker-js/faker/shared/operation-request.ts b/packages/openapi-ts/src/plugins/@faker-js/faker/shared/operation-request.ts
new file mode 100644
index 0000000000..a29a2e617d
--- /dev/null
+++ b/packages/openapi-ts/src/plugins/@faker-js/faker/shared/operation-request.ts
@@ -0,0 +1,175 @@
+import type { IR } from '@hey-api/shared';
+import { buildSymbolIn, pathToName } from '@hey-api/shared';
+
+import { $ } from '../../../../ts-dsl';
+import type { FakerJsFakerPlugin } from '../types';
+import { getFakerPackagePath } from './helpers';
+import type { ProcessorResult } from './processor';
+import type { FakerResult } from './types';
+
+interface RequestPart {
+ key: string;
+ result: FakerResult;
+}
+
+/**
+ * Convert a record of IR parameters into an IR object schema.
+ * Follows the same pattern as valibot's `buildOperationSchema`.
+ */
+function irParametersToIrSchema(
+ params: Record,
+): IR.SchemaObject | undefined {
+ const properties: Record = {};
+ const required: Array = [];
+
+ for (const key in params) {
+ const parameter = params[key]!;
+ properties[parameter.name] = parameter.schema;
+ if (parameter.required) {
+ required.push(parameter.name);
+ }
+ }
+
+ if (!Object.keys(properties).length) return undefined;
+
+ return { properties, required, type: 'object' };
+}
+
+/**
+ * Collect the non-void request parts from an operation.
+ * Returns an array of { key, schema } entries for body, headers, path, query.
+ */
+function collectRequestParts(
+ operation: IR.OperationObject,
+): ReadonlyArray<{ key: string; schema: IR.SchemaObject }> {
+ const parts: Array<{ key: string; schema: IR.SchemaObject }> = [];
+
+ if (operation.body) {
+ parts.push({ key: 'body', schema: operation.body.schema });
+ }
+
+ if (operation.parameters) {
+ for (const location of ['header', 'path', 'query'] satisfies ReadonlyArray<
+ keyof typeof operation.parameters
+ >) {
+ const params = operation.parameters[location];
+ if (!params) continue;
+
+ const propKey = location === 'header' ? 'headers' : location;
+ const schema = irParametersToIrSchema(params);
+ if (schema) {
+ parts.push({ key: propKey, schema });
+ }
+ }
+ }
+
+ return parts;
+}
+
+/**
+ * Generate a single request factory per operation that combines
+ * body, path params, query params, and headers into one object.
+ */
+export function irOperationRequestToAst({
+ operation,
+ path,
+ plugin,
+ processor,
+ tags,
+}: {
+ operation: IR.OperationObject;
+ path: ReadonlyArray;
+ plugin: FakerJsFakerPlugin['Instance'];
+ processor: ProcessorResult;
+ tags?: ReadonlyArray;
+}): void {
+ if (!plugin.config.requests.enabled) return;
+
+ const parts = collectRequestParts(operation);
+ if (parts.length === 0) return;
+
+ // Process each part independently through the processor
+ const processedParts: Array