ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
136 stars 64 forks source link

Openapi tool source code not getting regenerated after removing the generated code. #6591

Open gayaldassanayake opened 5 months ago

gayaldassanayake commented 5 months ago

Description: In openapi automate client generation, if the code is generated once with bal build, that code is deleted and bal build run again, the code is not getting generated again. However if we delete the target dir (which contains a cache for openapi tool), the generation works fine.

Steps to reproduce:

  1. In a new ballerina project add an openapi tool entry.
    [[tool.openapi]]
    id = "oa1"
    filePath="service.yaml"
    targetModule="oa1_target"
    options.mode = "client"
  2. Run bal build. This will create both target dir and the generated dir.
  3. Delete only the generated dir
  4. Re-run bal build

Affected Versions: 2201.9.0

OS, DB, other environment details and versions: MacOS

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):

lnash94 commented 5 months ago

@gayaldassanayake, With my concern, from a design perspective, there is a dependency between the target and generated directories, particularly with the package build commands, shouldn't we validate whether the target directory is available and ensure the presence of the generated folder, and vice versa, before continuing the process?