-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
When transforming an interface that includes nested objects (I have flattened it here for convenience, but even this flattened version does not work):
* @see https://partner.steamgames.com/doc/webapi/ISteamUserAuth#AuthenticateUserTicket
* @description Response from authenticating a user ticket.
*/
export interface AuthenticateUserTicketResponse {
response: AuthenticateUserTicketResponse_properties_response;
}
export interface AuthenticateUserTicketResponse_properties_response {
/**
* @pattern ^[0-9]{17}$
* @description The user's 64-bit SteamID if the ticket is valid.
*/
steamid?: string;
error?: AuthenticateUserTicketResponse_properties_response_properties_error;
}
export interface AuthenticateUserTicketResponse_properties_response_properties_error {
/** @description Error code if authentication fails. */
errorcode: number;
/**
* @minLength 1
* @description Error description if authentication fails.
*/
errordesc: string;
}
into a model, and then to anything else, in this case zod, typebox-codegen will strip it from the results. The results will only include types that do not contain custom types or objects:
import { z } from 'zod'
export type AuthenticateUserTicketResponse_properties_response_properties_error =
z.infer<
typeof AuthenticateUserTicketResponse_properties_response_properties_error
>
export const AuthenticateUserTicketResponse_properties_response_properties_error =
z.object({
errorcode: z.number(),
errordesc: z.string().min(1)
})
If you were wondering what the interface looked like before flattening:
/*** The response from the ISteamUserAuth/AuthenticateUserTicket/v1 endpoint.
* @see https://partner.steamgames.com/doc/webapi/ISteamUserAuth#AuthenticateUserTicket
* @description Response from authenticating a user ticket.
*/
export interface AuthenticateUserTicketResponse {
response: {
/**
* @pattern ^[0-9]{17}$
* @description The user's 64-bit SteamID if the ticket is valid.
*/
steamid?: string;
error?: {
/**
* @description Error code if authentication fails.
*/
errorcode: number;
/**
* @minLength 1
* @description Error description if authentication fails.
*/
errordesc: string;
};
};
}
Metadata
Metadata
Assignees
Labels
No labels