zenstackhq / zenstack

Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
https://zenstack.dev
MIT License
2.07k stars 88 forks source link

@zenstackhq/openapi: zenstack generate silently crashes if openapi plugin config uses empty strings #299

Closed potion-cellar closed 1 year ago

potion-cellar commented 1 year ago

Description and expected behavior When running zenstack generate, the command should not silently terminate if the plugin openapi configuration in a ZModel file contains empty strings for optional properties.

Screenshots Try using this configuration in a ZModel file:

plugin openapi {
    provider = '@zenstackhq/openapi'
    output = './openapi.yaml'
    title = 'My API'
    version = '1.0.0'
    summary = 'Skyview Weather'
    description = ''
    prefix = '/api'
}

Then run zenstack generate.

> zenstack generate

⌛️ ZenStack CLI v1.0.0-alpha.87, running plugins

The process exits after outputting the above message.

Environment (please complete the following information):

"@zenstackhq/openapi": "^1.0.0-alpha.87",
"@zenstackhq/runtime": "^1.0.0-alpha.87",
"@zenstackhq/server": "^1.0.0-alpha.87",
"zenstack": "^1.0.0-alpha.87"

"prisma": "^4.11.0",
"@prisma/client": "^4.11.0"

v18.15.0

PostgreSQL 15

Additional context Note that, in the above example, zenstack generate works fine if description is omitted entirely.

ymc9 commented 1 year ago

fixed by #315