A fossil belonging to one of the oldest known species of Jurassic dinosaur has been unearthed in Wales.