Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger creates invalid OpenAPI due to missing response descriptions #181

Open
mikkelam opened this issue Jan 2, 2025 · 0 comments
Open

Comments

@mikkelam
Copy link

mikkelam commented Jan 2, 2025

Example:

import Elysia from "elysia";
import { swagger } from "@elysiajs/swagger";

const app = new Elysia().use(swagger()).get("/", {}, {}).listen(3000);

with elysia 1.2.9 and swagger 1.2.0 produces this swagger (converted to yaml)

openapi: 3.0.3
info:
  title: Elysia Documentation
  description: Development documentation
  version: 0.0.0
paths:
  /:
    get:
      operationId: getIndex
      responses:
        '200': {}
components:
  schemas: {}

which produces errors in here: https://editor.swagger.io/

Structural error at paths./.get.responses.200
should have required property 'description'
missingProperty: description
Jump to line 10

Perhaps the plugin should just prefill some sample text like "Successful response" for 200 and so on (it seems like fastapi does that).

I could try and suggest some code changes if authors are happy with this approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant