Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

bf luis:generate:cs generates wrong class for "money/currency" prebuilt entity. #1069

Description

@GitDruid

What project is affected?

Virtual Assistant and Skill Template

What language is this in?

C#

What happens?

bf luis:generate:cs when called by update_cognitive_models.ps1 does not manage correctly the "money/currency" prebuilt entity.

I have an Hotel entity with two subentities HotelTimeFrame and TotalAmount. TotalAmount being modeled as a prebuilt money entity:

@ ml Hotel
    - @ ml HotelTimeFrame usesFeature MLTimeFrame
    - @ money TotalAmount

With this definition bf luis:generate:cs is generating the MySkillLuis.cs as following, with TotalAmount as string[]:

public class HotelClass
{
	public string[] HotelTimeFrame;
	public string[] TotalAmount;
	[JsonProperty("$instance")]
	public _InstanceHotel _instance;
}
public HotelClass[] Hotel;

This way, I get an exception in the Convert method of the generated class:

public void Convert(dynamic result)
{
	var app = JsonConvert.DeserializeObject<MySkillLuis>(
	JsonConvert.SerializeObject(
		result,
		new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Error = OnError }
	)
[...]

I manually changed the class definition as follows, with TotalAmount as Money[], and it worked:

public class HotelClass
{
	public string[] HotelTimeFrame;
	public Money[] TotalAmount;
	[JsonProperty("$instance")]
	public _InstanceHotel _instance;
}
public HotelClass[] Hotel;

But that's quite never a viable solution, since in many environment the update_cognitive_models.ps1 is executed by the ci/cd pipeline.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.P1Painful if we don't fix, won't block releasingcustomer-replied-toIndicates that the team has replied to the issue reported by the customer. Do not delete.customer-reportedIssue is created by anyone that is not a collaborator in the repository.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions