openapi-ts icon indicating copy to clipboard operation
openapi-ts copied to clipboard

Type errors in `vue-query.gen.ts`

Open zumm opened this issue 11 months ago • 5 comments

Description

I'm trying to use @tanstack/vue-query plugin, but getting type errors with infinite queries and mutations.

For infinite queries:

The inferred type of 'getMyHistoryInfiniteOptions' references an inaccessible 'unique symbol' type. A type annotation is necessary.ts(2527)
The inferred type of 'getMyHistoryInfiniteOptions' cannot be named without a reference to 'node_modules/.pnpm/@[email protected]/node_modules/@tanstack/query-core/build/modern/hydration-mKPlgzt9'. This is likely not portable. A type annotation is necessary.ts(2742)

For mutations:

The inferred type of 'readFeedVideosMutation' cannot be named without a reference to 'node_modules/.pnpm/@[email protected]/node_modules/@tanstack/query-core/build/modern/hydration-mKPlgzt9'. This is likely not portable. A type annotation is necessary.ts(2742)

My config:

import { defineConfig } from '@hey-api/openapi-ts'

export default defineConfig({
  experimentalParser: true,
  client: '@hey-api/client-fetch',
  input: 'src/api-client/openapi.yml',
  output: 'src/api-client',
  plugins: [
    '@tanstack/vue-query',
    {
      dates: true,
      name: '@hey-api/transformers',
    },
  ],
})

Reproducible example or configuration

No response

OpenAPI specification (optional)

openapi: 3.0.1

components:
  schemas:
    OK:
      type: object
      properties:
        ok:
          type: boolean
    Error:
      type: object
      properties:
        error:
          type: string
    Video:
      type: object
      required:
        - id
        - title
        - description
        - url
        - publishedAt
        - channelId
        - channelTitle
        - channelUrl
        - duration
        - commentCount
        - likeCount
        - viewCount
      properties:
        id:
          type: string
        title:
          type: string
        description:
          type: string
        url:
          type: string
        publishedAt:
          type: string
          format: date-time
        categoryId:
          type: string
        channelId:
          type: string
        channelTitle:
          type: string
        channelUrl:
          type: string
        duration:
          type: string
        commentCount:
          type: integer
          format: uint64
        likeCount:
          type: integer
          format: uint64
        viewCount:
          type: integer
          format: uint64
        thumbnails:
          $ref: '#/components/schemas/Thumbnails'
    Channel:
      type: object
      required:
        - id
        - title
        - description
        - url
        - commentCount
        - subscriberCount
        - videoCount
        - viewCount
      properties:
        id:
          type: string
        title:
          type: string
        description:
          type: string
        url:
          type: string
        subscriberCount:
          type: integer
          format: uint64
        commentCount:
          type: integer
          format: uint64
        videoCount:
          type: integer
          format: uint64
        viewCount:
          type: integer
          format: uint64
        thumbnails:
          $ref: '#/components/schemas/Thumbnails'
    Thumbnails:
      type: object
      properties:
        default:
          $ref: '#/components/schemas/Thumbnail'
        medium:
          $ref: '#/components/schemas/Thumbnail'
        high:
          $ref: '#/components/schemas/Thumbnail'
        standard:
          $ref: '#/components/schemas/Thumbnail'
        maxres:
          $ref: '#/components/schemas/Thumbnail'
    Thumbnail:
      type: object
      required:
        - url
        - width
        - height
      properties:
        url:
          type: string
        width:
          type: integer
        height:
          type: integer

paths:
  /my/history:
    get:
      summary: My history
      operationId: getMyHistory
      parameters:
        - name: offset
          in: query
          required: false
          schema:
            type: integer
        - name: count
          in: query
          required: true
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    $ref: '#/components/schemas/Video'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /feed/videos/read:
    post:
      operationId: readFeedVideos
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - ids
              properties:
                ids:
                  type: array
                  items:
                    type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OK'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

System information (optional)

@hey-api/client-fetch: 0.5.0 @hey-api/openapi-ts: 0.57.1

zumm avatar Nov 26 '24 11:11 zumm