bugraoz93 commented on code in PR #53597:
URL: https://github.com/apache/airflow/pull/53597#discussion_r2231344664


##########
airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/openapi-gen/queries/queries.ts:
##########
@@ -6,11 +6,7 @@ import { LoginBody } from "../requests/types.gen";
 import * as Common from "./common";
 export const useSimpleAuthManagerLoginServiceCreateTokenAllAdmins = <TData = 
Common.SimpleAuthManagerLoginServiceCreateTokenAllAdminsDefaultResponse, TError 
= unknown, TQueryKey extends Array<unknown> = unknown[]>(queryKey?: TQueryKey, 
options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => 
useQuery<TData, TError>({ queryKey: 
Common.UseSimpleAuthManagerLoginServiceCreateTokenAllAdminsKeyFn(queryKey), 
queryFn: () => SimpleAuthManagerLoginService.createTokenAllAdmins() as TData, 
...options });
 export const useSimpleAuthManagerLoginServiceLoginAllAdmins = <TData = 
Common.SimpleAuthManagerLoginServiceLoginAllAdminsDefaultResponse, TError = 
unknown, TQueryKey extends Array<unknown> = unknown[]>(queryKey?: TQueryKey, 
options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => 
useQuery<TData, TError>({ queryKey: 
Common.UseSimpleAuthManagerLoginServiceLoginAllAdminsKeyFn(queryKey), queryFn: 
() => SimpleAuthManagerLoginService.loginAllAdmins() as TData, ...options });
-export const useSimpleAuthManagerLoginServiceCreateToken = <TData = 
Common.SimpleAuthManagerLoginServiceCreateTokenMutationResult, TError = 
unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, {
-  requestBody: LoginBody;
-}, TContext>, "mutationFn">) => useMutation<TData, TError, {
-  requestBody: LoginBody;
-}, TContext>({ mutationFn: ({ requestBody }) => 
SimpleAuthManagerLoginService.createToken({ requestBody }) as unknown as 
Promise<TData>, ...options });
+export const useSimpleAuthManagerLoginServiceCreateToken = <TData = 
Common.SimpleAuthManagerLoginServiceCreateTokenMutationResult, TError = 
unknown, TContext = unknown>(options?: Omit<UseMutationOptions<TData, TError, 
void, TContext>, "mutationFn">) => useMutation<TData, TError, void, TContext>({ 
mutationFn: () => SimpleAuthManagerLoginService.createToken() as unknown as 
Promise<TData>, ...options });

Review Comment:
   Thanks for picking this up! 
   You are using the method on the `depens`, so I would expect that to be 
cascaded without any manual intervention. We have lots of examples using 
methods in `depends`. How about adding [that 
method](https://github.com/apache/airflow/pull/53597/files#diff-cda8d7272d1dab72e832ba2f91c66bcba5496f197a68501d6e68e6c7430efd96R26)
 to the Pydantic model `LoginBody`? We can add a model validator and return the 
self (datamodel) according to the method you have added. So validators allow us 
to make adjustments before returning the model. This can even be set before or 
after Pydantic's internal parsing and validation. Example model validator in 
our stack -> 
https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/api_fastapi/core_api/datamodels/variables.py#L38
   I haven't tried, so I am not 100% if this will work, but it could also fix 
maybe the UI generation of files since it won't be a custom method but a model 
validator on the Pydantic level.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to