So I was just thinking about my previous Minecraft experiences when I remembered something quite odd. One evening I was playing around and loading up some new worlds, This was pre 1.14 java. (But one thing to note, I was playing on an Ipad at the time) I am guessing this because I vividly remember the textures. So one world in specific, I loaded into it, Walked only a couple block and then encountered a exposed dungeon right there. Out in the sunlight. I freaked and then somehow lost the world ): So now I am wondering, Am i just crazy or has someone also experienced something like this?
Also, If it helps. It was behind a big plain, And in front of a small forest with a mountain the back. Or at least I THINK.
The only restriction on dungeon generation is that the floor and ceiling must be entirely solid (other structures, collapsing sand, etc can disrupt them after generation) and there must be 1-5 2 block high "openings" at floor level; exposure to skylight does not matter.
I recently found such a dungeon myself, a zombie dungeon under a village (of all places!):
In another world there was a zombie dungeon close to spawn, a few blocks into a small hill, with a zombie coming out right after I'd spawned in the world, followed by a few more later (I discovered the dungeon a bit later):
The zombies and dungeon are mentioned near the bottom of the first post and #9:
Both of these were modded worlds but dungeons generate the same way as in vanilla; here is an example from the current vanilla version which is directly exposed (the ones mentioned above are both a few blocks into a cave while this one has one side completely exposed in the open):
Dungeons generating in hillsides is a thing that happens, under the floor of deserts was more noticeable before 1.7 when they were made rarer and also a few updates later when sand no longer fell until touched if it generated floating.