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

Response without schema #71

Open
juliangehring opened this issue Jul 7, 2023 · 4 comments
Open

Response without schema #71

juliangehring opened this issue Jul 7, 2023 · 4 comments

Comments

@juliangehring
Copy link
Contributor

juliangehring commented Jul 7, 2023

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.

@ghost
Copy link

ghost commented Jul 16, 2023

I tried exactly the example you've given without seeing the error you have.

Using current release 0.1.10.

@juliangehring
Copy link
Contributor Author

The code with an empty schema (schema: {}) does not throw an error - however, it renders an empty json object in the schema on the documentation page. This is what I would like to avoid, for responses that don't return an object.

The error occurs when trying to omit schema, either by a) setting schema to null: schema: null or b) omitting schema completely:

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

which yields the Uncaught TypeError: Cannot read properties of undefined (reading 'generated')

@ghost
Copy link

ghost commented Jul 16, 2023

Yes I did observe that error when schema is missing.

A curious thing given everything in ResponseSchema is supposedly optional.

The same issue would apply when returning 204 No Content for a delete action which cannot contain content.

@juliangehring
Copy link
Contributor Author

juliangehring commented Jul 16, 2023

Thanks for confirming. I agree that it would be good to avoid the error when schema is missing.

If there are other ways to skip the schema, I would be open to ideas.

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