Closed razzeee closed 3 days ago
import { InfoObject } from "openapi3-ts/oas30" import { defineConfig } from "orval" export default defineConfig({ "one": { output: { workspace: "src/api", client: "react-query", mode: "tags-split", mock: true, prettier: true, clean: true, override: { query: { useQuery: true, useSuspenseQuery: true, }, header: (info: InfoObject): string[] => [ `Generated by orval 🍺`, `Do not edit manually.`, ...(info.title ? [info.title] : []), ...(info.description ? [info.description] : []), ...(info.version ? [`OpenAPI spec version: ${info.version}`] : []), ], }, }, input: { target: "./one.openapi.yaml", }, }, "two": { output: { workspace: "src/api", client: "react-query", mode: "tags-split", mock: true, prettier: true, clean: true, override: { query: { useQuery: true, useSuspenseQuery: true, }, header: (info: InfoObject): string[] => [ `Generated by orval 🍺`, `Do not edit manually.`, ...(info.title ? [info.title] : []), ...(info.description ? [info.description] : []), ...(info.version ? [`OpenAPI spec version: ${info.version}`] : []), ], }, }, input: { target: "./two.openapi.yaml", }, }
Get errors in src/api/index.ts as the names are the same
src/api/index.ts
I can't find a way to change the generated schema names Operation names seem solveable by doing
{ override: { operationName: (operation, route, verb) => { return `two${operation.operationId}` } } }
System: OS: Linux 6.10 Fedora Linux 40 (Workstation Edition) CPU: (16) x64 AMD Ryzen 7 PRO 8840U w/ Radeon 780M Graphics Memory: 11.21 GB / 30.00 GB Container: Yes Shell: 5.9 - /usr/bin/zsh npmPackages: @tanstack/react-query: ^5.52.2 => 5.52.2 axios: ^1.7.2 => 1.7.5 msw: ^2.3.5 => 2.3.5 orval: ^7.0.1 => 7.0.1 react: ^18.3.1 => 18.3.1
@razzeee here you go : https://gurubase.io/g/orval/change-generated-schema-names-in-orval
What are the steps to reproduce this issue?
What happens?
Get errors in
src/api/index.ts
as the names are the sameWhat were you expecting to happen?
I can't find a way to change the generated schema names Operation names seem solveable by doing
What versions are you using?
System: OS: Linux 6.10 Fedora Linux 40 (Workstation Edition) CPU: (16) x64 AMD Ryzen 7 PRO 8840U w/ Radeon 780M Graphics Memory: 11.21 GB / 30.00 GB Container: Yes Shell: 5.9 - /usr/bin/zsh npmPackages: @tanstack/react-query: ^5.52.2 => 5.52.2 axios: ^1.7.2 => 1.7.5 msw: ^2.3.5 => 2.3.5 orval: ^7.0.1 => 7.0.1 react: ^18.3.1 => 18.3.1