Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

UNR-1735 #1177

Merged

Conversation

improbable-davidrodriguez
Copy link
Contributor

Fix for generated code from external schema to call the right callbacks.

Description

Added control flow to prevent callbacks for all commands in a component to be called when a single one should.

Release note

External schema codegen tool is a new feature and this is a fix to that feature so there is no need for release note changes.

Tests

How did you test these changes prior to submitting this pull request?
Before the fix, getting a response to one command of a component would trigger the callback for all commands in that component. With the fix, this no longer happens and only the right callback is being called.

What automated tests are included in this PR?
None.

STRONGLY SUGGESTED: How can this be verified by QA?
Using a project that includes external schema with one component that has several commands and registering to several callbacks and seeing that only the right one is being called (This bug was discovered and tested in the upcoming DBSync Worker UnrealGDK tutorial).

Documentation

How is this documented (for example: release note, upgrade guide, feature page, in-code documentation)?

Bugfix, no documentation needed.

Primary reviewers

If your change will take a long time to review, you can name at most two primary reviewers who are ultimately responsible for reviewing this request. @ mention them.

@improbable-prow-robot
Copy link

Corresponding JIRA ticket: https://improbableio.atlassian.net/browse/UNR-1735

@improbable-prow-robot improbable-prow-robot added the size/XS Denotes a PR that changes 0-14 lines, ignoring generated files. label Jul 18, 2019
{Text.Indent(1, $@"auto Response = {Types.GetTypeDisplayName(component.QualifiedName)}::Commands::{Text.SnakeCaseToPascalCase(command.Name)}::Response({Types.GetTypeDisplayName(component.QualifiedName)}::Commands::{ Text.SnakeCaseToPascalCase(command.Name)}::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type)));
{Text.Indent(1, $@"if (Op.command_id == {command.CommandIndex})
{{
{Text.Indent(1, $@"auto Response = Op.status_code == Worker_StatusCode::WORKER_STATUS_CODE_SUCCESS ? {Types.GetTypeDisplayName(component.QualifiedName)}::Commands::{Text.SnakeCaseToPascalCase(command.Name)}::Response({Types.GetTypeDisplayName(component.QualifiedName)}::Commands::{ Text.SnakeCaseToPascalCase(command.Name)}::Response::Type::Deserialize(Schema_GetCommandResponseObject(Op.response.schema_type))) : {Types.GetTypeDisplayName(component.QualifiedName)}::Commands::{Text.SnakeCaseToPascalCase(command.Name)}::Response();
Copy link
Contributor

@al1y al1y Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is a monster, maybe split onto 3 lines? other than that lgtm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@improbable-davidrodriguez improbable-davidrodriguez merged commit 869e786 into 0.6.0-rc Jul 22, 2019
@improbable-davidrodriguez improbable-davidrodriguez deleted the bugfix/UNR-1735-external-schema-codegen-fix branch July 22, 2019 12:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
jira/UNR size/XS Denotes a PR that changes 0-14 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants