OpenAPITools / OpenAPITools/openapi-generator

[BUG] APEX Generator - Invalid interface: OASTreasuryTransaction

Open
#14,007 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?

    Using the full Stripe API spec.

  • Have you validated the input using an OpenAPI validator (example)?

    I used the CLI with validate and it found no issues.

  • Have you tested with the latest master to confirm the issue still exists?

    Yes

  • Have you searched for related issues/PRs?

    Yes

  • What's the actual output vs expected output?
Description

The generated code has errors as below:

 Error OASUpdateParams1TransferDataTest         Dependent class is invalid and needs recompilation:      
 Class OASUpdateParams1TransferData : Invalid interface: OASTransferData1 (16:54)
 Error OASUsBankAccountNetworks                 Expression cannot be assigned
 Error OASUsBankAccountNetworks                 Unexpected token '.'. (44:64)
 Error OASUsBankAccountNetworks                 Unexpected token 'List'. (44:45)
 Error OASUsBankAccountNetworks                 Unexpected token 'List'. (44:45)
 Error OASUsBankAccountNetworksTest             Invalid type: SupportedEnum (75:29)

It generates a class but instead of using the class as a property in POJO, the class is used as an interface.

public class OASUpdateParams1TransferData implements OASTransferData1, OASBusinessProfileSpecsSupportUrlAny {}

Where a List of Enum's is used in Example, it generates incorrect code.

usBankAccountNetworks.supported = List<SupportedEnum>.LIST_SUPPORTEDENUM_NEW_LIST_STRING_ACH_;

openapi-generator version

6.2.1 via Java JAR (Includes the fix locally done in bug reference below)

OpenAPI declaration file content or url

https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json

Generation Details
Steps to reproduce
  1. java -jar openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json -g apex
Related issues/PRs

Includes the bug fix (suggested) reported in this bug below:
https://github.com/OpenAPITools/openapi-generator/issues/13571

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the documented Java JAR command with the Stripe OpenAPI spec URL and the apex generator to reproduce the reported compiler errors. Inspect the Apex generator entry points and generated classes named in the report, including OASUpdateParams1TransferData and OASUsBankAccountNetworks; done means the generated code no longer uses invalid interfaces or malformed List-of-enum assignments.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.