Skip to content

Output schemas not properly generated. #468

@Huijiro

Description

@Huijiro

The /ssh route in the ops-center is not returning proper output typing as well typing seems different depending on how the useAPI is called.

Generated schemas:

/**
 * Input schema type for route: POST /api/ssh/token
 */
export type POSTApiSshTokenInputSchema = typeof sshTokenSchema_0;

/**
 * Output schema type for route: POST /api/ssh/token
 */
export type POSTApiSshTokenOutputSchema = never;

//...

'POST /api/ssh/token': {
			inputSchema: POSTApiSshTokenInputSchema;
			outputSchema: POSTApiSshTokenOutputSchema;
			stream: false;
			params: never;
};

Hono typing for the route:

(property) Hono<Env<Record<string, never>>, Schema, "/", "/">.post: HandlerInterface
<"/token", "/token", Promise<JSONRespondReturn<{
    success: false;
    message: string;
}, 500> | JSONRespondReturn<{
    success: false;
    message: string;
}, 400> | JSONRespondReturn<{
    success: false;
    message: string;
}, 404> | JSONRespondReturn<{
    success: true;
    region: string | null;
    token: string;
}, ContentfulStatusCode>>, DefaultInput<"json", {
    deploymentId?: string | undefined;
    projectId?: string | undefined;
}, {
    deploymentId?: string | undefined;
    projectId?: string | undefined;
}>, DefaultInput<...>, Env, Env<...>, MiddlewareHandler<...>>(path: "/token", handlers_0: H<...> & MiddlewareHandler<...>, handlers_1: H<...>) => Hono<...> (+22 overloads)

Using the useApi as

const { invoke } = useAPI('POST /api/ssh/token');

useAPI invoke typing:

const invoke: (input: {
    deploymentId?: string | undefined;
    projectId?: string | undefined;
}) => Promise<void>

Using the useApi as

const { invoke } = useAPI({
	method: 'POST',
	path: '/api/ssh/token',
});

useAPI invoke typing:

const invoke: (input: InferObjectShape<{
    question: StringSchema;
    entity: StringSchema;
    history: OptionalSchema<ArraySchema<ObjectSchema<{
        role: UnionSchema<[LiteralSchema<"user">, LiteralSchema<"assistant">]>;
        content: StringSchema;
    }>>>;
    context: OptionalSchema<StringSchema>;
}> | {
    deploymentId?: string | undefined;
    projectId?: string | undefined;
}) => Promise<InferObjectShape<{
    answer: StringSchema;
    queriesExecuted: NumberSchema;
    history: ArraySchema<...>;
}>>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions