From 0b6bfba1e6e862a77a5247d778027cc1080e0e25 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 11 Apr 2024 04:50:18 +0100 Subject: [PATCH] fix(parser): add header to generated files --- packages/openapi-ts/src/compiler/index.ts | 29 ++++++++++----- packages/openapi-ts/src/compiler/typedef.ts | 6 ++-- packages/openapi-ts/src/compiler/types.ts | 8 ++--- packages/openapi-ts/src/compiler/utils.ts | 35 ++++++++++++------- packages/openapi-ts/src/utils/write/index.ts | 4 ++- packages/openapi-ts/src/utils/write/models.ts | 12 +++---- .../openapi-ts/src/utils/write/schemas.ts | 2 +- .../openapi-ts/src/utils/write/services.ts | 2 +- packages/openapi-ts/src/utils/write/type.ts | 4 +-- .../test/generated/v2/index.ts.snap | 2 ++ .../test/generated/v2/models.ts.snap | 2 ++ .../test/generated/v2/schemas.ts.snap | 2 ++ .../test/generated/v2/services.ts.snap | 2 ++ .../test/generated/v3/index.ts.snap | 2 ++ .../test/generated/v3/models.ts.snap | 2 ++ .../test/generated/v3/schemas.ts.snap | 2 ++ .../test/generated/v3/services.ts.snap | 2 ++ .../test/generated/v3_angular/index.ts.snap | 2 ++ .../test/generated/v3_angular/models.ts.snap | 2 ++ .../test/generated/v3_angular/schemas.ts.snap | 2 ++ .../generated/v3_angular/services.ts.snap | 2 ++ .../test/generated/v3_axios/index.ts.snap | 2 ++ .../test/generated/v3_client/index.ts.snap | 2 ++ .../test/generated/v3_client/models.ts.snap | 2 ++ .../test/generated/v3_client/services.ts.snap | 2 ++ .../test/generated/v3_date/index.ts.snap | 2 ++ .../test/generated/v3_date/models.ts.snap | 2 ++ .../test/generated/v3_date/schemas.ts.snap | 2 ++ .../v3_enums_typescript/index.ts.snap | 2 ++ .../v3_enums_typescript/models.ts.snap | 2 ++ .../v3_enums_typescript/schemas.ts.snap | 2 ++ .../v3_enums_typescript/services.ts.snap | 2 ++ .../v3_legacy_positional_args/index.ts.snap | 2 ++ .../v3_legacy_positional_args/models.ts.snap | 2 ++ .../services.ts.snap | 2 ++ .../test/generated/v3_models/index.ts.snap | 2 ++ .../test/generated/v3_models/models.ts.snap | 2 ++ .../test/generated/v3_node/index.ts.snap | 2 ++ .../test/generated/v3_options/index.ts.snap | 2 ++ .../test/generated/v3_options/models.ts.snap | 2 ++ .../generated/v3_options/services.ts.snap | 2 ++ .../test/generated/v3_xhr/index.ts.snap | 2 ++ 42 files changed, 128 insertions(+), 40 deletions(-) diff --git a/packages/openapi-ts/src/compiler/index.ts b/packages/openapi-ts/src/compiler/index.ts index 05954aa87..304af9e90 100644 --- a/packages/openapi-ts/src/compiler/index.ts +++ b/packages/openapi-ts/src/compiler/index.ts @@ -5,31 +5,42 @@ import ts from 'typescript'; import * as module from './module'; import * as typedef from './typedef'; import * as types from './types'; -import { tsNodeToString } from './utils'; +import { addLeadingComment, tsNodeToString } from './utils'; export type { Property } from './typedef'; export type { Comments } from './utils'; export type { Node } from 'typescript'; export class TypeScriptFile { + private _headers: Array = []; private _imports: Array = []; private _items: Array = []; - public addNamedImport(...params: Parameters): void { - this._imports.push(compiler.import.named(...params)); + public add(...nodes: Array): void { + this._items = [...this._items, ...nodes]; } - public add(...nodes: Array): void { - this._items.push(...nodes); + public addHeader() { + const text = 'This file is auto-generated by @hey-api/openapi-ts'; + const comment = addLeadingComment(undefined, [text], true, false) + this._headers = [...this._headers, comment] + return this; + } + + public addNamedImport(...params: Parameters): void { + this._imports = [...this._imports, compiler.import.named(...params)]; } public toString(seperator: string = '\n') { - const values: string[] = []; + let output: string[] = []; + if (this._headers.length) { + output = [...output, this._headers.join('\n')]; + } if (this._imports.length) { - values.push(this._imports.map(v => tsNodeToString(v)).join('\n')); + output = [...output, this._imports.map(v => tsNodeToString(v)).join('\n')]; } - values.push(...this._items.map(v => (typeof v === 'string' ? v : tsNodeToString(v)))); - return values.join(seperator); + output = [...output, ...this._items.map(v => (typeof v === 'string' ? v : tsNodeToString(v)))]; + return output.join(seperator); } public write(file: PathOrFileDescriptor, seperator: string = '\n') { diff --git a/packages/openapi-ts/src/compiler/typedef.ts b/packages/openapi-ts/src/compiler/typedef.ts index 545e55503..118d2e27b 100644 --- a/packages/openapi-ts/src/compiler/typedef.ts +++ b/packages/openapi-ts/src/compiler/typedef.ts @@ -1,6 +1,6 @@ import ts from 'typescript'; -import { addLeadingJSDocComment, type Comments } from './utils'; +import { addLeadingComment, type Comments } from './utils'; export const createTypeNode = (base: any) => ts.factory.createTypeReferenceNode(base as string); @@ -23,7 +23,7 @@ export const createTypeAliasDeclaration = ( ts.factory.createTypeReferenceNode(type) ); if (comments?.length) { - addLeadingJSDocComment(node, comments); + addLeadingComment(node, comments); } return node; }; @@ -54,7 +54,7 @@ export const createTypeInterfaceNode = (properties: Property[], isNullable: bool ); const comment = property.comment; if (comment) { - addLeadingJSDocComment(signature, comment); + addLeadingComment(signature, comment); } return signature; }) diff --git a/packages/openapi-ts/src/compiler/types.ts b/packages/openapi-ts/src/compiler/types.ts index dfc4de341..d3c865a60 100644 --- a/packages/openapi-ts/src/compiler/types.ts +++ b/packages/openapi-ts/src/compiler/types.ts @@ -1,6 +1,6 @@ import ts from 'typescript'; -import { addLeadingJSDocComment, type Comments, isType, ots } from './utils'; +import { addLeadingComment, type Comments, isType, ots } from './utils'; /** * Convert an unknown value to an expression. @@ -77,7 +77,7 @@ export const createObjectType = ( } const assignment = ts.factory.createPropertyAssignment(key, initializer); if (c?.length) { - addLeadingJSDocComment(assignment, c); + addLeadingComment(assignment, c); } return assignment; }) @@ -109,13 +109,13 @@ export const createEnumDeclaration = ( const assignment = ts.factory.createEnumMember(key, initializer); const c = comments?.[key]; if (c) { - addLeadingJSDocComment(assignment, c); + addLeadingComment(assignment, c); } return assignment; }) ); if (comment.length) { - addLeadingJSDocComment(declaration, comment); + addLeadingComment(declaration, comment); } return declaration; }; diff --git a/packages/openapi-ts/src/compiler/utils.ts b/packages/openapi-ts/src/compiler/utils.ts index 0001f56f3..0cb46005e 100644 --- a/packages/openapi-ts/src/compiler/utils.ts +++ b/packages/openapi-ts/src/compiler/utils.ts @@ -88,25 +88,34 @@ export const isType = (value: T | undefined): value is T => value !== undefin export type Comments = Array; -export const addLeadingJSDocComment = ( +export const addLeadingComment = ( node: ts.Node | undefined, text: Comments, - hasTrailingNewLine: boolean = true + hasTrailingNewLine: boolean = true, + useJSDocStyle = true, ): string => { - if (!text.filter(Boolean).length) { + const comments = text.filter(Boolean); + + if (!comments.length) { return ''; } + // if node is falsy, assume string mode - if (node) { - ts.addSyntheticLeadingComment( - node, - ts.SyntaxKind.MultiLineCommentTrivia, - ['*', ...text, ' '].filter(Boolean).join('\n'), - hasTrailingNewLine - ); - return ''; + if (!node) { + if (useJSDocStyle) { + const result = ['/**', ...comments.map(row => ` * ${row}`), ' */'].join('\n'); + return hasTrailingNewLine ? `${result}\n` : result; + } + + const result = comments.map(row => `// ${row}`).join('\n'); + return hasTrailingNewLine ? `${result}\n` : result; } - const result = ['/**', ...text, ' */'].filter(Boolean).join('\n'); - return hasTrailingNewLine ? `${result}\n` : result; + ts.addSyntheticLeadingComment( + node, + ts.SyntaxKind.MultiLineCommentTrivia, + ['*', ...comments.map(row => ` * ${row}`), ' '].join('\n'), + hasTrailingNewLine + ); + return ''; }; diff --git a/packages/openapi-ts/src/utils/write/index.ts b/packages/openapi-ts/src/utils/write/index.ts index 7d8283e90..4a3de6886 100644 --- a/packages/openapi-ts/src/utils/write/index.ts +++ b/packages/openapi-ts/src/utils/write/index.ts @@ -12,7 +12,9 @@ import { getConfig } from '../config'; */ export const writeClientIndex = async (client: Client, outputPath: string): Promise => { const config = getConfig(); - const file = new TypeScriptFile(); + + const file = new TypeScriptFile().addHeader(); + if (config.name) { file.add(compiler.export.named([config.name], `./${config.name}`)); } diff --git a/packages/openapi-ts/src/utils/write/models.ts b/packages/openapi-ts/src/utils/write/models.ts index 40d241ec1..dbf4636c8 100644 --- a/packages/openapi-ts/src/utils/write/models.ts +++ b/packages/openapi-ts/src/utils/write/models.ts @@ -27,14 +27,14 @@ const processEnum = (client: Client, model: Model, exportType: boolean) => { properties[key] = value; const comment = enumerator.customDescription || enumerator.description; if (comment) { - comments[key] = [` * ${escapeComment(comment)}`]; + comments[key] = [escapeComment(comment)]; } }); if (exportType) { const comment: Comments = [ - model.description && ` * ${escapeComment(model.description)}`, - model.deprecated && ' * @deprecated', + model.description && escapeComment(model.description), + model.deprecated && '@deprecated', ]; if (config.enums === 'typescript') { nodes = [...nodes, compiler.types.enum(model.name, properties, comment, comments)]; @@ -57,8 +57,8 @@ const processEnum = (client: Client, model: Model, exportType: boolean) => { const processType = (client: Client, model: Model) => { const comment: Comments = [ - model.description && ` * ${escapeComment(model.description)}`, - model.deprecated && ' * @deprecated', + model.description && escapeComment(model.description), + model.deprecated && '@deprecated', ]; const type = toType(model); return compiler.typedef.alias(model.name, type!, comment); @@ -245,7 +245,7 @@ const processServiceTypes = (services: Service[]) => { * @param client Client containing models, schemas, and services */ export const writeClientModels = async (openApi: OpenApi, outputPath: string, client: Client): Promise => { - const file = new TypeScriptFile(); + const file = new TypeScriptFile().addHeader(); for (const model of client.models) { const nodes = processModel(client, model); diff --git a/packages/openapi-ts/src/utils/write/schemas.ts b/packages/openapi-ts/src/utils/write/schemas.ts index 6169809c8..ddae47151 100644 --- a/packages/openapi-ts/src/utils/write/schemas.ts +++ b/packages/openapi-ts/src/utils/write/schemas.ts @@ -10,7 +10,7 @@ import { ensureValidTypeScriptJavaScriptIdentifier } from '../../openApi/common/ * @param outputPath Directory to write the generated files to */ export const writeClientSchemas = async (openApi: OpenApi, outputPath: string): Promise => { - const file = new TypeScriptFile(); + const file = new TypeScriptFile().addHeader(); const addSchema = (name: string, obj: any) => { const validName = `$${ensureValidTypeScriptJavaScriptIdentifier(name)}`; diff --git a/packages/openapi-ts/src/utils/write/services.ts b/packages/openapi-ts/src/utils/write/services.ts index efe6a88b4..39ec1cd7d 100644 --- a/packages/openapi-ts/src/utils/write/services.ts +++ b/packages/openapi-ts/src/utils/write/services.ts @@ -22,7 +22,7 @@ export const writeClientServices = async ( templates: Templates ): Promise => { const config = getConfig(); - const file = new TypeScriptFile(); + const file = new TypeScriptFile().addHeader(); let imports: string[] = []; let results: string[] = []; diff --git a/packages/openapi-ts/src/utils/write/type.ts b/packages/openapi-ts/src/utils/write/type.ts index bc5312445..55638a4f7 100644 --- a/packages/openapi-ts/src/utils/write/type.ts +++ b/packages/openapi-ts/src/utils/write/type.ts @@ -80,8 +80,8 @@ const typeInterface = (model: Model) => { } return { comment: [ - property.description && ` * ${escapeComment(property.description)}`, - property.deprecated && ` * @deprecated`, + property.description && escapeComment(property.description), + property.deprecated && '@deprecated', ], isReadOnly: property.isReadOnly, isRequired: maybeRequired === '', diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/index.ts.snap index 61a05bfe7..c14945757 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/models.ts.snap index de6d98108..35da90ed7 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * Testing multiline comments in string: First line * Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.ts.snap index bdfad9078..dad60c490 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export const $CommentWithBreaks = { description: `Testing multiline comments in string: First line Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.ts.snap index ba70f15ab..edf695563 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/index.ts.snap index 61a05bfe7..c14945757 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/models.ts.snap index 3310da2c9..1106f350e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * Testing multiline comments in string: First line * Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.ts.snap index 83429f186..4fd7f42c8 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export const $CommentWithBreaks = { description: `Testing multiline comments in string: First line Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.ts.snap index fa88317ca..764e312db 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/index.ts.snap index c02ca6d29..a8c5b01a4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; export * from './models'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/models.ts.snap index 828f884b6..fa26e6aaa 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * Testing multiline comments in string: First line * Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/schemas.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/schemas.ts.snap index 83429f186..4fd7f42c8 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/schemas.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/schemas.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export const $CommentWithBreaks = { description: `Testing multiline comments in string: First line Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.ts.snap index 22e06330a..08744e459 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import type { Observable } from 'rxjs'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/index.ts.snap index 01c3fb836..f073fa9c4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/index.ts.snap index d9e7d75fa..775575ade 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiClient } from './ApiClient'; export { ApiError } from './core/ApiError'; export { BaseHttpRequest } from './core/BaseHttpRequest'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/models.ts.snap index 57165a215..01599c56d 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * Testing multiline comments in string: First line * Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.ts.snap index a67109164..fe155e9fd 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + import type { CancelablePromise } from './core/CancelablePromise'; import type { BaseHttpRequest } from './core/BaseHttpRequest'; import type { $OpenApiTs } from './models'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/index.ts.snap index 9545f7d9c..9db93bf52 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/index.ts.snap @@ -1,2 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts + export * from './models'; export * from './schemas'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/models.ts.snap index 3d15122ee..da0184393 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * This is a model that contains a some patterns */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/schemas.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/schemas.ts.snap index 83429f186..4fd7f42c8 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/schemas.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/schemas.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export const $CommentWithBreaks = { description: `Testing multiline comments in string: First line Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/index.ts.snap index 61a05bfe7..c14945757 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/models.ts.snap index 14a3d5610..70a02008c 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * Testing multiline comments in string: First line * Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/schemas.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/schemas.ts.snap index 83429f186..4fd7f42c8 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/schemas.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/schemas.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export const $CommentWithBreaks = { description: `Testing multiline comments in string: First line Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.ts.snap index fa88317ca..764e312db 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/index.ts.snap index 7c784a6bc..6203bf8d9 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/models.ts.snap index 0718223b8..03d47f551 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * This is a model with one string property */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.ts.snap index b4ba71d87..95e5be915 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/index.ts.snap index e9644dae4..f122138e6 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/index.ts.snap @@ -1 +1,3 @@ +// This file is auto-generated by @hey-api/openapi-ts + export * from './models'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/models.ts.snap index 828f884b6..fa26e6aaa 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * Testing multiline comments in string: First line * Second line diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/index.ts.snap index 01c3fb836..f073fa9c4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/index.ts.snap index 7c784a6bc..6203bf8d9 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/models.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/models.ts.snap index 3af0c9c03..abcc691fe 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/models.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/models.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + /** * This is a model with one string property */ diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.ts.snap index f61b38aa1..c9a836a8e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/index.ts.snap index 01c3fb836..f073fa9c4 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/index.ts.snap @@ -1,3 +1,5 @@ +// This file is auto-generated by @hey-api/openapi-ts + export { ApiError } from './core/ApiError'; export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI';