We are using a typescript openAPI 3 code generator for our angular project and ran into a problem: The interface is generated correctly for the user login as follows:
export interface TokenObtainPair {
email: string;
password: string;
readonly access: string;
}
When I now try to write a function based on this to request a new login token I do the following:
login(Email: string, Password: string): Observable<any> {
const pair: TokenObtainPair = {
email: Email,
password: Password,
}
return this.apiService.apiTokenCreate({TokenObtainPair: pair });
}
Now angular says that error TS2739: Type '{ email: string; password: string; }' is missing the following properties from type 'TokenObtainPair': access
. I could add access: ''
to the request and it works, but I would want to do it without that manual intervention. If the field is marked as readonly, it should only be required on read and not on write.