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

Fix C# Tags for Enums #70

Merged
merged 1 commit into from
Jul 12, 2023
Merged

Conversation

jdetter
Copy link
Collaborator

@jdetter jdetter commented Jul 11, 2023

Description of Changes

  • In C# we need to tag enum members with a [SpacetimeDB.Enum] tag, otherwise our custom serialization logic for enums won't work. This either has been broken or has never worked. If you have some types in rust like this:
#[SpacetimeType]
pub enum EnumValue {
  Item,
  Cargo
}

#[SpacetimeType]
pub struct MyType {
 pub value: EnumValue
}

These types need to be generated in C# as:

public enum EnumValue {
  Item,
  Cargo
}

public class MyType {
    [SpacetimeDB.Enum]
    public EnumValue value;
}

Before this PR, the tag was being omitted.

API

  • This is a breaking change to the module API
  • This is a breaking change to the ClientAPI

If the API is breaking, please state below what will break

Copy link
Contributor

@dbrinkmanncw dbrinkmanncw left a comment

Choose a reason for hiding this comment

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

Tested and working

@dbrinkmanncw dbrinkmanncw merged commit a66ced8 into master Jul 12, 2023
4 checks passed
cloutiertyler pushed a commit that referenced this pull request Aug 1, 2023
cloutiertyler pushed a commit that referenced this pull request Aug 1, 2023
@cloutiertyler cloutiertyler deleted the jdetter/fix-enum-tag-generation branch August 1, 2023 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants