ballerina-platform / ballerina-library

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

Represent package information in OAS generation when the type is import from different package #6646

Closed lnash94 closed 3 months ago

lnash94 commented 5 months ago

Description:

import ballerina/time;

public type User record {
    time:Date birthDate;
    string name?;
    int id;
};

Describe your problem(s) Generate OAS is missing the information regarding the package this type comes from therefore we need to assign a OAS extension by adding the details.

TharmiganK commented 4 months ago

We could come up with an extension like the below:

x-ballerina-type:
   orgName: ballerina
   packageName: time
   moduleName: time
   version: 2.4.0
   modulePrefix: time

There are few design concerns with adding these information:

  1. These information will be added for all the types including the types in the same package. There can be instances where the types are not public (which is ideally incorrect, but currently ballerina only issues warnings for this). In those scenarios, we should make sure we expose the public ones.
  2. This is useful in ballerina client/service generation since we do not need to generate the predefined types again. But this is just noise for other language generators or users. So it would be better if we generate this only when we give a specific flag
TharmiganK commented 3 months ago

Ballerina to OpenAPI generation now supports ballerina specific type extensions