Skip to content

Union type in record fields are not handled in data mapper #1602

@KavinduZoysa

Description

@KavinduZoysa

Description

Union types that contain a nil or error as members are not handled in data mapper when the field is a union type.

Steps to Reproduce


type UserInfo record {|
   string username;
   string password;
   Student? student;
|};

type Student record {|
   string username;
   string password;
   string 'record;
   json data;
   any info;
|};

const string CONST = "CONST";
Student myStudent = {};

service OASServiceType on new http:Listener(9090) {

	resource function get pet() returns int|http:NotFound {
        do {
            Student? student1 = {};
            Student student2 = {};
            UserInfo userInfo = {};
		} on fail error e {
			return http:NOT_FOUND;
		}
	}
}

Open UserInfo userInfo = {}; in data mapper

Version

1.3.0

Environment Details (with versions)

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions