Open nekman opened 3 weeks ago
@nekman can you share your configuration?
@mrlubos Sure, here:
import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({
client: '@hey-api/client-fetch',
input: 'openapi/customer-api.yaml',
output: {
format: 'prettier',
path: 'generated/client/customer-api',
lint: 'eslint'
},
services: {
asClass: true
},
schemas: false
});
@nekman yeah that's not going to generate any httpRequest
or constructor with new clients. Can you mock the @hey-api/client-fetch
module instead?
Hi, coming from openapi-typescript-codegen where a generated class have the
BaseHttpRequest
as a dependency in the constructor.Example:
This makes it very flexible when it comes to testing, I can just replace the
httpRequest
with a mocked instance.Generating the same API using this project will however only create functions or a class with static methods: Example:
This makes it harder to test without writing a wrapper. Is it possible to generate something similar as we get with the openapi-typescript-codegen, or have I missed some other settings?