Skip to content

Property starting with number gets generated #1055

@jackoob

Description

@jackoob

What are the steps to reproduce this issue?

With orval v6.20.0

test.yaml

openapi: 3.0.3

info:
  title: test
  description: |
    test
  version: 1.0.0
paths:
  /test:
    get:
      responses:
        418:
          $ref: '#/components/responses/418'

components:
  responses:
    418:
      description: I'm a teapot
      content:
        'application/json':
          schema:
            type: object
            properties: {}

orval.config.js

export default defineConfig({
  test: {
    input: './test.yaml',
    output: {
      mode: 'tags',
      target: 'src/generated/test/test.ts',
      prettier: true,
      mock: false,
      override: {
        mutator: {
          path: 'src/lib/axios.ts',
          name: 'test',
        },
      },
    },
  },
});

What happens?

It generates type with numbered name like:

export type 418Response = { [key: string]: any };

What were you expecting to happen?

To generate type with letter before numbered name like:

export type n418Response = { [key: string]: any };

What versions are you using?

Operating System: Sonoma 14.1
Package Version: 6.20.0
Node Version: node 20.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions