openapiballerinaballerina-swan-lake

How to handle complex paths in openAPI spec when using bal openapi -i command?


I'm trying to generate the Ballerina stubs for an OpenAPI spec. However I get the error below.

The service generation can not proceed due to the openapi definition contain following complex path(s):

/Reference_AssociationInfo(AssociationNo='{AssociationNo}',PartyType='{PartyType}',Identity='{Identity}')
/Reference_SupplierTemplateLov(TemplateSupplierId='{TemplateSupplierId}')
/Reference_CompanyFinance(Company='{Company}')
/Lookup_IsoCountry_EntitySet(Id='{Id}')

How can I fix this?


Solution

  • At the moment, Ballerina service generation from OpenAPI specification does not support complex paths as mentioned in the diagnostics. This is a limitation in the ballerina resource syntax. Please refer to this issue for more information: https://github.com/ballerina-platform/ballerina-spec/issues/1238#issuecomment-1767582117

    In Ballerina client generation, the tool fallback to use remote methods for client rather the resource methods(default option). But in the case of service stub generation, it is not possible. That is why you are getting this error.