# Enums and @:rtti

**URL:** <https://community.haxe.org/t/enums-and-rtti/4168>\
**Category:** Haxe\
**Created:** [February 6, 2024, 6:35pm UTC](https://community.haxe.org/t/enums-and-rtti/4168 "2024-02-06T18:35:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshtynjala](https://community.haxe.org/user_avatar/community.haxe.org/joshtynjala/32/792_2.png) [@joshtynjala](https://community.haxe.org/u/joshtynjala)\
**Post date:** [February 6, 2024, 6:35pm UTC](https://community.haxe.org/t/enums-and-rtti/4168/1 "2024-02-06T18:35:49Z")

</div>

If I add `@:rtti` metadata to an enum, I can’t seem to find an `__rtti` field, like I can for a class.

```haxe
import haxe.rtti.Rtti;

class MyClass {
	static function main() {
		trace(Reflect.field(MyOtherClass, "__rtti")); // { ...omitted... }
		trace(Reflect.field(MyEnum, "__rtti")); // null
	}
}

@:rtti
enum MyEnum {
	One;
	Two(a:String, b:Float);
}

@:rtti
class MyOtherClass {}

```

Is there any other option? I’d like to be able to determine at runtime which parameters are defined (including their names and types) for `MyEnum.Two()`. Just like I can do for methods on a class.

---

<div class="post-metadata">

**Author:** ![joshtynjala](https://community.haxe.org/user_avatar/community.haxe.org/joshtynjala/32/792_2.png) [@joshtynjala](https://community.haxe.org/u/joshtynjala)\
**Post date:** [February 8, 2024, 12:00am UTC](https://community.haxe.org/t/enums-and-rtti/4168/2 "2024-02-08T00:00:32Z")

</div>

Interestingly, reviewing the `haxe.rtti.XmlParser` source code, it seems capable of parsing RTTI data for enums and abstracts.

I guess I could try to generate the XML data myself in a macro. It looks like the format isn’t officially documented, but I can probably figure it out based on what `XmlParser` is doing. It would certainly save me time if the compiler could generate RTTI for enums and abstracts for me, though, so if anyone has any idea how to force the compiler to do that, I’d still greatly appreciate it!

EDIT: Aha! I see that it’s the same format used for XML data passed to dox. Thankfully, now I have some examples of XML for enums and abstracts to work from for generating it manually. That also explains why `XmlParser` is capable of handling those types, even if the compiler doesn’t seem to generate it for `@:rtti`.
