There is no legal obligation to provide a reference except in a few sectors, such as financial services, but any reference that is provided must be true, accurate and fair. Your employer owes a duty both to you and any prospective employer.
Many employers have a policy of only providing a reference with very basic information (e.g. to confirm dates of employment and job title).
The text of references can sometimes be agreed as a term of a negotiated settlement and annexed to a settlement agreement, along with a promise that no oral reference will be given. Speak to your union rep and see whether something suitable can be agreed.
If your employer categorically refuses to give you a reference, consider whether anyone outside your employer can be approached for a reference, for example someone you worked with in the recent past who no longer works for your employer.