rebuild swagger immediately after clearing to ensure events run on next call