Thanks! Didn’t realise that customization existed via Swagger.
As far as macro goes, you don’t need to do anything special for SAM, since the SAM macro has already translated function definitions into standard CloudFormation template.
Alex Debrie has a good tutorial: https://www.alexdebrie.com/posts/cloudformation-macros/