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.

Merge pull request #3168 from hey-api/docs/sdk-copy-fix

docs: fix formatting on sdk plugin page

authored by

Lubos and committed by
GitHub
24d8b038 fc1514a1

+46 -43
+34 -34
dev/openapi-ts.config.ts
··· 46 46 // openapi: '3.1.0', 47 47 // paths: {}, 48 48 // }, 49 - // path: path.resolve( 50 - // getSpecsPath(), 51 - // // '2.0.x', 52 - // // '3.0.x', 53 - // '3.1.x', 54 - // // 'circular.yaml', 55 - // // 'dutchie.json', 56 - // // 'enum-names-values.yaml', 57 - // 'full.yaml', 58 - // // 'integer-formats.yaml', 59 - // // 'invalid', 60 - // // 'object-property-names.yaml', 61 - // // 'openai.yaml', 62 - // // 'opencode.yaml', 63 - // // 'pagination-ref.yaml', 64 - // // 'schema-const.yaml', 65 - // // 'sdk-instance.yaml', 66 - // // 'sdk-method-class-conflict.yaml', 67 - // // 'sdk-nested-classes.yaml', 68 - // // 'sdk-nested-conflict.yaml', 69 - // // 'string-with-format.yaml', 70 - // // 'transformers.json', 71 - // // 'transformers-recursive.json', 72 - // // 'type-format.yaml', 73 - // // 'validators.yaml', 74 - // // 'validators-circular-ref.json', 75 - // // 'validators-circular-ref-2.yaml', 76 - // // 'zoom-video-sdk.json', 77 - // ), 49 + path: path.resolve( 50 + getSpecsPath(), 51 + // '2.0.x', 52 + // '3.0.x', 53 + '3.1.x', 54 + // 'circular.yaml', 55 + // 'dutchie.json', 56 + // 'enum-names-values.yaml', 57 + // 'full.yaml', 58 + // 'integer-formats.yaml', 59 + // 'invalid', 60 + // 'object-property-names.yaml', 61 + // 'openai.yaml', 62 + 'opencode.yaml', 63 + // 'pagination-ref.yaml', 64 + // 'schema-const.yaml', 65 + // 'sdk-instance.yaml', 66 + // 'sdk-method-class-conflict.yaml', 67 + // 'sdk-nested-classes.yaml', 68 + // 'sdk-nested-conflict.yaml', 69 + // 'string-with-format.yaml', 70 + // 'transformers.json', 71 + // 'transformers-recursive.json', 72 + // 'type-format.yaml', 73 + // 'validators.yaml', 74 + // 'validators-circular-ref.json', 75 + // 'validators-circular-ref-2.yaml', 76 + // 'zoom-video-sdk.json', 77 + ), 78 78 // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0', 79 79 // path: 'http://localhost:4000/', 80 80 // path: 'http://localhost:8000/openapi.json', 81 81 // path: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', 82 - path: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml', 82 + // path: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml', 83 83 // watch: { 84 84 // enabled: true, 85 85 // interval: 500, ··· 290 290 // }, 291 291 }, 292 292 { 293 - // auth: false, 293 + auth: false, 294 294 // client: false, 295 295 // getSignature: ({ fields, signature, operation }) => { 296 296 // // ... ··· 304 304 // // casing: 'snake_case', 305 305 // name: 'OpencodeClient', 306 306 // }, 307 - containerName: 'PetStore', 307 + containerName: 'OpencodeClient', 308 308 // nesting(operation) { 309 309 // if (operation.path === '/pet/{petId}' || operation.path === '/pet') { 310 310 // return ['pet', operation.operationId?.replace(/Pet/, '') || operation.method.toLocaleLowerCase()]; ··· 318 318 // methods: 'static', 319 319 // nesting: 'id', 320 320 // segmentName: '{{name}}Seggy', 321 - // strategy: 'single', 321 + strategy: 'single', 322 322 // strategy(operation) { 323 323 // const locations = OperationStrategy.byTags({ 324 324 // fallback: 'default', ··· 335 335 // }, 336 336 // strategyDefaultTag: 'DaxLikedThis', 337 337 }, 338 - // paramsStructure: 'flat', 338 + paramsStructure: 'flat', 339 339 // responseStyle: 'data', 340 340 // signature: 'auto', 341 341 // signature: 'client',
+12 -9
docs/openapi-ts/plugins/sdk.md
··· 109 109 110 110 ::: code-group 111 111 112 + <!-- prettier-ignore-start --> 112 113 ```ts [example] 113 114 import { client } from './client.gen'; 114 115 import type { AddPetData, AddPetErrors, AddPetResponses } from './types.gen'; 115 116 116 - export class PetStore extends HeyApiClient { 117 - // [!code ++] 117 + export class PetStore extends HeyApiClient { // [!code ++] 118 118 /** ... */ 119 119 } 120 120 ``` 121 + <!-- prettier-ignore-end --> 121 122 122 123 ```js [config] 123 124 export default { ··· 148 149 149 150 ::: code-group 150 151 152 + <!-- prettier-ignore-start --> 151 153 ```ts [example] 152 154 import { client } from './client.gen'; 153 155 import type { AddPetData, AddPetErrors, AddPetResponses } from './types.gen'; 154 156 155 157 export class Pet extends HeyApiClient { 156 - public add(options: Options<PostPetData>) { 157 - // [!code ++] 158 + public add(options: Options<PostPetData>) { // [!code ++] 158 159 /** ... */ 159 160 } 160 161 } 161 162 162 163 export class PetStore extends HeyApiClient { 163 - get pet(): Pet { 164 - // [!code ++] 164 + get pet(): Pet { // [!code ++] 165 165 /** ... */ 166 166 } 167 167 } 168 168 ``` 169 - 169 + <!-- prettier-ignore-end --> 170 170 <!-- prettier-ignore-start --> 171 171 ```js [config] 172 172 export default { ··· 239 239 240 240 ::: code-group 241 241 242 + <!-- prettier-ignore-start --> 242 243 ```ts [example] 243 244 import * as v from 'valibot'; 244 245 245 246 export const addPet = (options: Options<AddPetData>) => 246 247 (options.client ?? client).post<AddPetResponses, AddPetErrors>({ 247 - requestValidator: async (data) => await v.parseAsync(vAddPetData, data), // [!code ++] 248 - responseValidator: async (data) => 248 + requestValidator: async (data) => // [!code ++] 249 + await v.parseAsync(vAddPetData, data), // [!code ++] 250 + responseValidator: async (data) => // [!code ++] 249 251 await v.parseAsync(vAddPetResponse, data), // [!code ++] 250 252 /** ... */ 251 253 }); 252 254 ``` 255 + <!-- prettier-ignore-end --> 253 256 254 257 ```js [config] 255 258 export default {