How can I generate structures underground?

basicly I want to generate sturctures underground in caves, i want it to always spawn in air not like how a fosil generates only if its touching something other than air, but the issue i have is that it will spawn but only if exposed to sky light, please help im very new to structure generation in datapacks
Continue to help post