EInviteStatus - Not marked at UENUM


Could you please set this enum and might be all the OSS Enum to be part of the reflection system?

OSS is meaned to be plugged to external source like Steam, MCP, or custom system. If we want to use the current interface, the EInviteStatus value (in FriendsInterface) from my OSS is in String format and I can’t map it without doing a switch statement.


Ps: it’s a followup from this discussion

What are you trying to do, aside from the straightforward request you are making?

You are trying to convert back and forth with FString? Can you outline the flow right now, starting with what form you are in initially and the places you are converting?

Thanks, I’ll try to help.

The invite status value is coming from my Http Request in Json Format. As of today we decided to map the enum on our Oss Backend to the enum “string name”.

I initially thought about using the reflection via LookupEnumName or FindEnumIndex function but it’s not doable because of the UENUM attributes that is not set.

So my only way is a sequence of IF statement as the switch do not work with FString.

So my code is something like:
IF ( value == TEXT("…")
else if ( value == TEXT("…")
else if ( value == TEXT("…")

There might be otherway to dot it “nicely” as I don’t know all the background stuff in the engine, but for me it was not the proper way to deal with this. A better approach can have been the Switch but in this case, it’s not compatible.

This is why I raised this question to know if it was intended and if it was the way you are dealing with it on your backend.

As for now, in the OSS system that are provided, I didn’t see any example on how to deal with this enum.


The original idea was the OSS wasn’t using UObject on purpose, because it was heavy weight and required “classes.h” files back when workflow/iteration was less than ideal for some of this. It seemed pretty unnecessary at the time with the understanding that Blueprints and such would implement “online” using OSS but not in a 1:1 fashion. It would simplify steps into nodes that handle more of the work for you.

That aside, I don’t see UENUM going on that enum any time soon.

What I suggest is you convert to FName right out of your json. Then you have fast compares because its number based. Switch statements will also work in this case.

Thanks for the update.
Now I understand the pro’s of this approach.

If I understand properly, the pseudo code should be:

FNAME Value = FNAME(JsonValue);
Switch Value
case FNAME(TEXT("Unknown")):
case  FNAME(TEXT("Accepted")):

Is that correct?

Yes that would work nicely. You can make the FNames static or otherwise “constructed once” and use them throughout your code base.

I know this is less than UENUM, but digging deep into LookupEnumName and FindEnumIndex for conversion sounds more like modifications to tools/editor than it does to runtime. My json conversions typically go the int32 route, knowing that there are possible compatibility issues there, but going to/from string is alright also if you are ok with the FName conversions.