Skip to content

Orval imports module via an incorrect file name / a potentially non-existing file #3066

@Arnagos

Description

@Arnagos

Description

Orval imports via an incorrect file name / a potentially non-existing file

Image

Configuration (orval.config)

import { defineConfig } from 'orval';

export default defineConfig({
  OSS: {
    input: {
      target: './swagger.json'
    },
    output: {
      clean: true,
      mode: 'tags-split',
      target: 'src/api/oss-api.ts',
      schemas: { type: 'zod', path: 'src/api' },
      httpClient: 'axios',
      client: 'react-query',
      mock: true,
      override: {
        header: (info) => [
          `Generated by Orval 🍺`,
          `Do not edit manually.`,
          ...(info.title ? [info.title] : []),
          ...(info.description ? [info.description] : []),
          ...(info.version ? [`OpenAPI spec version: ${info.version}`] : [])
        ],
        enumGenerationType: 'const',
        useNullForOptional: true,
        fetch: {
          forceSuccessResponse: true,
          runtimeValidation: true
        },
        mutator: {
          path: './src/utils/api/requests.ts',
          name: 'customInstance'
        },
        query: {
          useQuery: true,
          useSuspenseQuery: true
        },
        mock: {
          required: true
        }
      }
    }
  }
});

Environment

System:
OS: Windows 11 10.0.26200
CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13800H
Memory: 16.67 GB / 63.67 GB
npmPackages:
@tanstack/react-query: 5.90.21 => 5.90.21
axios: 1.13.6 => 1.13.6
msw: 2.12.10 => 2.12.10
orval: 8.5.2 => 8.5.2
react: 19.2.4 => 19.2.4
zod: 3.25.76 => 3.25.76

Expected behavior

Correct file name is used / missing file is generated.

Actual behavior

No response

OpenAPI document (minimal, if applicable)

    "/api/app/oss-identity-user/import-users-from-file": {
      "post": {
        "tags": [
          "OssIdentityUser"
        ],
        "parameters": [
          {
            "name": "FileType",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/ImportUsersFromFileType"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "File": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "File": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportUsersFromFileOutput"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImportUsersFromFileOutput"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              }
            }
          },
          "501": {
            "description": "Not Implemented",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoteServiceErrorResponse"
                }
              }
            }
          }
        }
      }
    },

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    zodZod related issue

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions