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

Typescript generator crashes if discriminant values start with digits #5711

Open
twitchard opened this issue Jan 22, 2025 · 0 comments
Open
Labels
bug Issues reporting bugs. product/sdk-generator Fern's SDK Generator that outputs client libraries in 7 languages

Comments

@twitchard
Copy link

twitchard commented Jan 22, 2025

CLI Version from fern.config.json

0.50.6

Generator & Version from generators.yml

fernapi/fern-typescript-node-sdk 0.39.7

Minimal API Specification

openapi: 3.1.0
info:
  title: Minimal Repro
  version: '1.0'
paths: {}
components:
  schemas:
    Foo:
      type: object
      properties:
        type:
          const: 1foo
    Bar:
      type: object
      properties:
        type:
          const: 1bar
    SingleDiscriminatedSchema:
      oneOf:
        - $ref: "#/components/schemas/Foo"
        - $ref: "#/components/schemas/Bar"
      discriminator:
        propertyName: type
        mapping:
          1foo: "#/components/schemas/Foo"
          1bar: "#/components/schemas/Bar"

Actual Generated Code

Crashes with

ERROR 2025-01-22T21:55:39.885Z [unioned]: fernapi/fern-typescript-node-sdk Unexpected! Inserting syntax kind of InterfaceDeclaration, but ExpressionStatement was inserted.
DEBUG 2025-01-22T21:55:39.885Z [unioned]: fernapi/fern-typescript-node-sdk Error
                                                                               at e$a (/Users/twitchard/.npm/_npx/abf6f9cced229dfb/node_modules/fern-api/cli.cjs:1709:3490)
                                                                               at vJu.failWithoutThrowing (/Users/twitchard/.npm/_npx/abf6f9cced229dfb/node_modules/fern-api/cli.cjs:1709:4389)
                                                                               at vJu.failAndThrow (/Users/twitchard/.npm/_npx/abf6f9cced229dfb/node_modules/fern-api/cli.cjs:1709:4318)
                                                                               at Object.failed (/Users/twitchard/.npm/_npx/abf6f9cced229dfb/node_modules/fern-api/cli.cjs:1798:381)
                                                                               at Object._visit (/Users/twitchard/.npm/_npx/abf6f9cced229dfb/node_modules/fern-api/cli.cjs:94:157941)
                                                                               at Object._visit (/Users/twitchard/.npm/_npx/abf6f9cced229dfb/node_modules/fern-api/cli.cjs:94:157677)
                                                                               at gbu.processUpdate (/Users/twitchard/.npm/_npx/abf6f9cced229dfb/node_modules/fern-api/cli.cjs:1798:277)
                                                                               at Timeout.d [as _onTimeout] (/Users/twitchard/.npm/_npx/abf6f9cced229dfb/node_modules/fern-api/cli.cjs:1798:10517)
                                                                               at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
@twitchard twitchard added bug Issues reporting bugs. product/sdk-generator Fern's SDK Generator that outputs client libraries in 7 languages labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues reporting bugs. product/sdk-generator Fern's SDK Generator that outputs client libraries in 7 languages
Development

No branches or pull requests

1 participant