Response without schema

Open
#71 4 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
openapi, typescript
Domain
api

Research direction

Start in worker.js at getType and getParsedSchema, using the response configuration shown in the issue with the schema omitted or set to null. Reproduce the TypeError, then verify that a response with no returned schema is accepted and no empty JSON schema is rendered.

Written by the indexing model from the issue text.

Description

Is it possible to define a response that has no schema, e.g. for return an error?

Currently, the schema needs to be set, for example like

responses: {
    '415': {
        description: 'Not supported',
        schema: {}
    }
}

which renders an empty json object in the schema on the documentation page.

Omitting the schema or setting it to null fails with

Uncaught TypeError: Cannot read properties of undefined (reading 'generated')
at worker.js:268:20 in getType
at worker.js:265:126 in x
at worker.js:327:5 in j
at worker.js:442:20 in getParsedSchema
at worker.js:393:21
at worker.js:709:8

It would be nice if one could represent that nothing gets returned.

Dominant language
TypeScript
Stars
777
Forks
74
Avg merge
16h 30m
Merged PRs (30d)
27

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/chanfana

All issues in cloudflare/chanfana

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.