Does an XML sitemap need to have a .xml extension?

Im using a CMS that generates a sitemap automatically but without “.xml”.IS this ok?

Can we put this is our robots.txt:

Sitemap: https://www.example.com/sitemap

or must it be:

Sitemap: https://www.example.com/sitemap.xml