unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

defineRouteMeta not working with imported values #2641

Open zRelux opened 1 month ago

zRelux commented 1 month ago

Environment

Nitro npm:nitropack-nightly@latest Bun 1.1.21

Reproduction

const OpenApiUserProperties: Record<string, SchemaObject | ReferenceObject> = {
    id: { type: "string" },
};

defineRouteMeta({
    openAPI: {
        tags: ["user"],
        description: "Get user information",
        responses: {
            200: {
                description: "OK",
                content: {
                    "application/json": {
                        schema: {
                            type: "object",
                            properties: {
                                status: { type: "string" },
                                result: {
                                    type: "object",
                                    properties: OpenApiUserProperties,
                                },
                            },
                        },
                    },
                },
            },
        },
    },
});

Describe the bug

Seems like I cannot import any variables inside the openAPI object, it would be very useful to be able to do so since I for example this api returns a value from DB

Additional context

No response

Logs

No response