I am trying to create a library that will generate data for a project of mine. I currently can generate some basic data types but had a problem with how to generate something more complex like a record.
I am not sure how I can go about generating the fields of a record. Is there a way to recurse or do reflection to get the fields in order to generate data?
Long ago I wrote a blog about type introspection in Ada: see.
I do not know if this is what you want. You do not generate records, you use them to describe things. The method is actively deployed in Simple Components for network protocols. The idea is that the network packet is represented by a record type which is then introspected to input/output the fields. E.g. see ASN.1 implementation.
You can also look into a library called libadalang. It is available via alire and some package managers (I know msys2 in windows provides it). It can parse Ada code and break it down, so maybe it can provide you some functionality you need.
It’s very heavy weight though and not early user friendly, so it might be a project and a half to get started in.
Then add more complexity, notably composite types, different outputs where composite types may be expanded recursively till reaching scalar types, if you have to.
NB: LEA has this template available from its Actions menu.