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

Configure Feed

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

chore: remove param info from service comments

Lubos 05f349ad 93a6308e

+19 -43
+1 -38
examples/openapi-ts-fetch/src/client/services.gen.ts
··· 24 24 /** 25 25 * Get museum hours 26 26 * Get upcoming museum operating hours. 27 - * @param data The data for the request. 28 - * @param data.startDate Starting date to retrieve future operating hours from. Defaults to today's date. 29 - * @param data.page Page number to retrieve. 30 - * @param data.limit Number of days per page. 31 - * @returns GetMuseumHoursResponse Success. 32 - * @throws ApiError 33 27 */ 34 28 export const getMuseumHours = (options?: Options<GetMuseumHoursData>) => 35 29 client.get<GetMuseumHoursResponse2>({ ··· 40 34 /** 41 35 * Create special events 42 36 * Creates a new special event for the museum. 43 - * @param data The data for the request. 44 - * @param data.requestBody 45 - * @returns SpecialEventResponse Success. 46 - * @throws ApiError 47 37 */ 48 38 export const createSpecialEvent = (options: Options<CreateSpecialEventData>) => 49 39 client.post<CreateSpecialEventResponse>({ ··· 54 44 /** 55 45 * List special events 56 46 * Return a list of upcoming special events at the museum. 57 - * @param data The data for the request. 58 - * @param data.startDate Starting date to retrieve future operating hours from. Defaults to today's date. 59 - * @param data.endDate End of a date range to retrieve special events for. Defaults to 7 days after `startDate`. 60 - * @param data.page Page number to retrieve. 61 - * @param data.limit Number of days per page. 62 - * @returns ListSpecialEventsResponse Success. 63 - * @throws ApiError 64 47 */ 65 48 export const listSpecialEvents = (options?: Options<ListSpecialEventsData>) => 66 49 client.get<ListSpecialEventsResponse2>({ ··· 71 54 /** 72 55 * Get special event 73 56 * Get details about a special event. 74 - * @param data The data for the request. 75 - * @param data.eventId Identifier for a special event. 76 - * @returns SpecialEventResponse Success. 77 - * @throws ApiError 78 57 */ 79 58 export const getSpecialEvent = (options: Options<GetSpecialEventData>) => 80 59 client.get<GetSpecialEventResponse>({ ··· 84 63 85 64 /** 86 65 * Update special event 66 + * 87 67 * Update the details of a special event. 88 - * @param data The data for the request. 89 - * @param data.eventId Identifier for a special event. 90 - * @param data.requestBody 91 - * @returns SpecialEventResponse Success. 92 - * @throws ApiError 93 68 */ 94 69 export const updateSpecialEvent = (options: Options<UpdateSpecialEventData>) => 95 70 client.patch<UpdateSpecialEventResponse>({ ··· 100 75 /** 101 76 * Delete special event 102 77 * Delete a special event from the collection. Allows museum to cancel planned events. 103 - * @param data The data for the request. 104 - * @param data.eventId Identifier for a special event. 105 - * @returns void Success - no content. 106 - * @throws ApiError 107 78 */ 108 79 export const deleteSpecialEvent = (options: Options<DeleteSpecialEventData>) => 109 80 client.delete<DeleteSpecialEventResponse>({ ··· 114 85 /** 115 86 * Buy museum tickets 116 87 * Purchase museum tickets for general entry or special events. 117 - * @param data The data for the request. 118 - * @param data.requestBody 119 - * @returns BuyMuseumTicketsResponse Success. 120 - * @throws ApiError 121 88 */ 122 89 export const buyMuseumTickets = (options: Options<BuyMuseumTicketsData>) => 123 90 client.post<BuyMuseumTicketsResponse2>({ ··· 128 95 /** 129 96 * Get ticket QR code 130 97 * Return an image of your ticket with scannable QR code. Used for event entry. 131 - * @param data The data for the request. 132 - * @param data.ticketId Identifier for a ticket to a museum event. Used to generate ticket image. 133 - * @returns GetTicketCodeResponse Scannable event ticket in image format. 134 - * @throws ApiError 135 98 */ 136 99 export const getTicketCode = (options: Options<GetTicketCodeData>) => 137 100 client.get<GetTicketCodeResponse2>({
+18 -5
packages/openapi-ts/src/utils/write/services.ts
··· 2 2 3 3 import { 4 4 ClassElement, 5 + type Comments, 5 6 compiler, 6 7 FunctionParameter, 7 8 type Node, ··· 142 143 return returnType; 143 144 }; 144 145 145 - const toOperationComment = (operation: Operation) => { 146 + const toOperationComment = (operation: Operation): Comments => { 146 147 const config = getConfig(); 148 + 149 + if (config.client.startsWith('@hey-api')) { 150 + const comment = [ 151 + operation.deprecated && '@deprecated', 152 + operation.summary && escapeComment(operation.summary), 153 + operation.description && escapeComment(operation.description), 154 + ]; 155 + return comment; 156 + } 157 + 147 158 let params: string[] = []; 159 + 148 160 if (operation.parameters.length) { 149 161 if (config.useOptions) { 150 162 params = [ 151 163 '@param data The data for the request.', 152 164 ...operation.parameters.map( 153 - (p) => 154 - `@param data.${p.name} ${p.description ? escapeComment(p.description) : ''}`, 165 + (parameter) => 166 + `@param data.${parameter.name} ${parameter.description ? escapeComment(parameter.description) : ''}`, 155 167 ), 156 168 ]; 157 169 } else { 158 170 params = operation.parameters.map( 159 - (p) => 160 - `@param ${p.name} ${p.description ? escapeComment(p.description) : ''}`, 171 + (parameter) => 172 + `@param ${parameter.name} ${parameter.description ? escapeComment(parameter.description) : ''}`, 161 173 ); 162 174 } 163 175 } 176 + 164 177 const comment = [ 165 178 operation.deprecated && '@deprecated', 166 179 operation.summary && escapeComment(operation.summary),