Conflict Response type
anchan828 opened this issue · comments
Description
@hey-api/openapi-ts: 0.43.1
Conflicts occur because the same schema is defined as the auto-generated type name. If there is a conflict, is it possible to not generate a Response type or to change the name of the Response freely?
// This file is auto-generated by @hey-api/openapi-ts
export type AGetResponse = {
id: string;
};
export type AGetResponse = AGetResponse;
export type $OpenApiTs = {
'/api/a': {
get: {
res: {
200: AGetResponse;
};
};
};
};
OpenAPI specification (optional)
openapi: 3.0.0
info:
title: Test
tags:
- name: A
components:
schemas:
AGetResponse:
type: object
properties:
id:
type: string
required:
- id
paths:
/api/a:
get:
operationId: A_get
summary: Get A
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
"200":
description: Get A response.
content:
application/json:
schema:
$ref: "#/components/schemas/AGetResponse"
tags:
- A
Configuration
import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({
input: './openapi.yml',
output: './client',
});
System information (optional)
https://stackblitz.com/edit/hey-api-example-smflvh?file=client%2Ftypes.gen.ts
Start a new pull request in StackBlitz Codeflow.
Hah, every time I think the name is safe enough for conflicts, it gets disproved immediately. I'll improve deduplication strategy, will add underscores to names
@anchan828 I went with a simple counter strategy, keep incrementing the identifier every time there's a conflict – Foo, Foo2, Foo3, Foo4, etc. Please let me know if this works for you once you try v0.43.2. 🙏