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

Add support to union of maps, tables and array of maps and tables #3121

Closed
MohamedSabthar opened this issue Jul 15, 2022 · 2 comments
Closed
Labels
module/serdes Issues related to the Ballerina serdes module Status/Blocked Issues that are currently blocked. Team/PCM Protocol connector packages related issues Type/Task

Comments

@MohamedSabthar
Copy link
Member

Description:
Current serdes implementation doesn't support unions of map<>, table<>, map<>[] and table<>[] due to name collision issue. Ideally we need to support this feature.

Ex:

type RecordType record {
   int score;
};
type UnionType map<int>|map<RecordType>;

To generate the schema for the UnionType in protobuf level, the union members should have unique names. One way to avoid name collision is to allow the user to use the map type with a reference types as below.

type RecordType record {
   int score;
};
type ScoreWithIntConstraint map<int>;
type ScoreWithRecordConstraint map<RecordType>;;
type UnionType ScoreWithIntConstraint|ScoreWithRecordConstraint;

This way we could eliminate the name collision issue in protobuf level and generate a schema for UnionType as below,

message UnionBuilder {
 message ScoreWithIntConstraint___MapBuilder {
   ...
 }
 message ScoreWithRecordConstraint___MapBuilder {
   ...
 }
 ScoreWithIntConstraint___MapBuilder ScoreWithIntConstraint_unionField = 1;
 ScoreWithRecordConstraint___MapBuilder ScoreWithRecordConstraint_unionField = 2;
}

Describe your task(s)
Implement above solution and throw an error for non referenced member (table, map) types.

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):

@MohamedSabthar MohamedSabthar added Type/Task module/serdes Issues related to the Ballerina serdes module Team/PCM Protocol connector packages related issues Status/Blocked Issues that are currently blocked. labels Jul 15, 2022
@MohamedSabthar
Copy link
Member Author

Depends on #36716

@MohamedSabthar
Copy link
Member Author

We are closing this issue because the serdes module has been deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/serdes Issues related to the Ballerina serdes module Status/Blocked Issues that are currently blocked. Team/PCM Protocol connector packages related issues Type/Task
Projects
Archived in project
Development

No branches or pull requests

1 participant