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

[Bug] ts-morph exception using PayPal OpenAPI spec #3415

Open
johnpyp opened this issue Apr 21, 2024 · 0 comments
Open

[Bug] ts-morph exception using PayPal OpenAPI spec #3415

johnpyp opened this issue Apr 21, 2024 · 0 comments
Assignees
Labels
typescript TypeScript models, clients, and server interfaces

Comments

@johnpyp
Copy link

johnpyp commented Apr 21, 2024

Describe the Bug

Failure when generating from public paypal OpenAPI specs.

# .... Lots of logs
Generating /src/serialization/types/SubscriptionsCreate422DetailsItem.ts
Sent error event to coordinator
/nodeCli.cjs:179343
            throw new common2.errors.NotImplementedError(`Unexpected! Inserting syntax kind of ${common2.getSyntaxKindName(expectedKind)}, but ${child.getKindName()} was inserted.`);
                  ^

NotImplementedError: Unexpected! Inserting syntax kind of InterfaceDeclaration, but ExpressionStatement was inserted.
    at getRangeWithoutCommentsFromArray (/nodeCli.cjs:179343:19)
    at insertIntoBracesOrSourceFileWithGetChildren (/nodeCli.cjs:180859:14)
    at ModuleDeclaration._insertChildren (/nodeCli.cjs:189483:18)
    at ModuleDeclaration.insertInterfaces (/nodeCli.cjs:189297:23)
    at ModuleDeclaration.addInterfaces (/nodeCli.cjs:189291:23)
    at ModuleDeclaration.addInterface (/nodeCli.cjs:189288:23)
    at _GeneratedUnionSchema.generateRawTypeDeclaration (/nodeCli.cjs:277148:34)
    at _GeneratedUnionSchema.generateModule (/nodeCli.cjs:277112:10)
    at _GeneratedUnionSchema.writeSchemaToFile (/nodeCli.cjs:277095:10)
    at _GeneratedUnionSchema.writeSchemaToFile (/nodeCli.cjs:277227:11)

Node.js v18.1.0

Seems to be related to some unexpected ts-morph invariant being broken, but I'm not sure.

Information to Reproduce

CLI Version

The version of the Fern CLI you are
using (found in fern.config.json).

Local build, latest commit 079a084

Generator Version

The version of the generator you are using (found in generators.yml). Plus any custom configuration required to reproduce the bug (found in generators.yml).

Bug happens on Typescript generators 0.13.0 / 0.15.0-rc0 / any I've tested

default-group: local
groups:
  local:
    generators:
      - name: fernapi/fern-typescript-node-sdk
        version: 0.13.0
        output:
          location: local-file-system
          path: ../generated/sdks/typescript

I also tried the Python generator, and it generated successfully.

API Definition

Here's the spec that causes the issue: https://github.com/paypal/paypal-rest-api-specifications/raw/main/openapi/billing_subscriptions_v1.json

I'm not sure what the minimal reproduction is unfortunately, I'm not even sure what causes the issue. However, running generate on this api should cause the issue pretty easily.

Actual SDK

The buggy SDK that is produced: N/A (errors out)

Expected SDK

N/A

Additional Context

To reproduce, I'd just try the minimal init / generate from the above using --openapi, it should happen pretty easily.

@johnpyp johnpyp added the typescript TypeScript models, clients, and server interfaces label Apr 21, 2024
@johnpyp johnpyp changed the title [Bug] [Bug] ts-morph exception using PayPal OpenAPI spec Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript TypeScript models, clients, and server interfaces
Development

No branches or pull requests

2 participants