Before anything else, sauté the finely grated onion with the garlic in a little oil — this is what makes the patties light and airy. Then mix all the ingredients together and let the mixture rest for an hour.
Knead the mixture again and shape it into patties, pressing a light dimple in the center of each with your finger (not as deep as for donuts or bagels).
Fry all the patties in oil and set them aside.
For the sauce, sauté chopped onions in the same oil you fried the patties in. Set the onions aside, then in the same oil add sugar and vinegar with a little water until the sugar dissolves. Add the patties and fried onions to the sauce and let it simmer briefly — just be careful the sauce doesn't dry out completely.
Arrange the patties in a serving dish and garnish with the fried onions. I hope this recipe changes how you see shami, the same way it changed mine.