When a declaratory remedy is sought, all persons having or alleging an interest which may be affected by the declaration shall be included as parties, and no declaration shall impair the rights of persons not parties to the proceedings. In any proceeding where the validity of a municipal ordinance or franchise is at issue, the corresponding municipality shall be included as a party, and the Secretary of Justice shall also be served notice of the proceedings, pursuant to the provisions of Rule 21.3.