Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orval overuses AnyOf types delimiter #1644

Open
jaxxreal opened this issue Sep 27, 2024 · 0 comments
Open

Orval overuses AnyOf types delimiter #1644

jaxxreal opened this issue Sep 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jaxxreal
Copy link

What are the steps to reproduce this issue?

  1. Generate orval client with the following config:
export default defineConfig({
  apiClient: {
    input: {
      target: 'http://localhost:3001/swagger-json',
    },
    output: {
      target: './src/client/orval.ts',
      schemas: './src/orval-types',
      mode: 'single',
      client: 'swr',
      override: {
        mutator: {
          path: './src/client/httpClient.ts',
          name: 'makeRequest',
        },
        useNamedParameters: true
      },
    },
    hooks: {
      afterAllFilesWrite: 'eslint --fix',
    },
  },
});

What happens?

Look at the types generated. Names like ListOfActivitiesResponseAnyOfDataAnyOfItemAnyOfAttributesAnyOfDataAnyOfItemAnyOfTargetAnyOfId are pretty common. OpenAPI schema for the given example has NO anyOf conditions.

What were you expecting to happen?

If an OpenAPI spec has no anyOf condition I don't expect to see them on my types. So the expected type name would be:
ListOfActivitiesResponseDataItemAttributesDataItemTargetId

Any logs, error output, etc?

Any other comments?

It's an issue because nearly every single generated file has a decent amount of AnyOf.

I know that the project is looking for contributors, so I would appreciate minimal guidance on where to start my search for a solution. Maybe it's a configuration issue? Please let me know.

What versions are you using?

[email protected]

Please execute npx envinfo --system --npmPackages orval,zod,axios,msw,swr,@tanstack/react-query,@tanstack/vue-query,react,vue and paste the results here.

System:
    OS: macOS 14.6.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 94.64 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
@melloware melloware added the bug Something isn't working label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants