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

Ignoring underscores in operationId results in duplicate functions #1747

Open
evanhaldane opened this issue Feb 26, 2025 · 3 comments
Open
Assignees
Labels
bug 🔥 Something isn't working prioritized 🚚 This issue has been prioritized and will be worked on soon

Comments

@evanhaldane
Copy link

Description

If your openapi spec has entries with operationIds like:

operationId: account___note_retrieve
...
operationId: account_note_retrieve

(which are auto-generated by drf-spectacular based on the paths)

then then both get mapped to accountNoteRetrieve (presumably because all underscores are ignored?)

This is using client-axios.

Reproducible example or configuration

npx @hey-api/openapi-ts -i 'schema.yml' -o src/schemas/mySchema -c @hey-api/client-axios

OpenAPI specification (optional)

/api/account/{blah}/{foo}-{bar}/note:
    get:
      operationId: account___note_retrieve
      parameters:
      - in: path
        name: blah
        schema:
          type: string
        required: true
      - in: path
        name: foo
        schema:
          type: string
        required: true
      - in: path
        name: bar
        schema:
          type: string
        required: true
/api/account/{blah}/note:
    get:
      operationId: account_note_retrieve
      parameters:
      - in: path
        name: blah
        schema:
          type: string
        required: true

System information (optional)

No response

@evanhaldane evanhaldane added the bug 🔥 Something isn't working label Feb 26, 2025
@mrlubos
Copy link
Member

mrlubos commented Feb 26, 2025

@evanhaldane what would be the expected result beyond "it works"? You could choose to preserve the casing style which would work around this, but if you want to use certain casing, would appending a number work?

getAccountNoteRetrieve()
getAccountNoteRetrieve2()
getAccountNoteRetrieve3()
// ...

@mrlubos mrlubos self-assigned this Feb 26, 2025
@mrlubos mrlubos added the prioritized 🚚 This issue has been prioritized and will be worked on soon label Feb 26, 2025
@evanhaldane
Copy link
Author

@mrlubos that seems like a reasonable solution that should guarantee uniqueness while making it pretty clear they're different.

@mrlubos
Copy link
Member

mrlubos commented Feb 27, 2025

Let's do that then. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔥 Something isn't working prioritized 🚚 This issue has been prioritized and will be worked on soon
Projects
None yet
Development

No branches or pull requests

2 participants