Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.
This repository was archived by the owner on Sep 14, 2022. It is now read-only.

No clear error handling documentation #410

@wilfredjonathanjames

Description

@wilfredjonathanjames

I'm a little perplexed. I cannot seem to find the documentation regarding swagger error handling. I have searched in all the usual places for answers to my questions without delving into the code, combed through the docs, and searched for keywords. All I found were seemingly outdated solutions. Perhaps I missed something.

My problem is - when I get a validation error it comes as an ugly JSON response with my request buffer attached. How do developers opt out, or modify this error object?

I am using a project generated with swagger project create, with express.

I also want to be able to generate a valid swagger error from within a controller, as we used to be able to do with swagger-express. Something like

throw swagger.errors.notFound('pet');

https://github.com/swagger-api/swagger-node/tree/2.0.x

Where has this functionality gone?

If that fails, I want to handle errors in the express way - with error handling middleware - but this doesn't seem to work.. I want to choose what I surface to API consumers.

And the final thing, is that the swagger error responses are coming back clipped. Example:

{"message":"Response validation failed: failed schema validation","code":"SCHE

Am I please able to have some help in resolving these issues?

Many thanks,
Wilfred


EDIT: I have raised an issue on swagger-node-runner regarding two of the above:
apigee-127/swagger-node-runner#48

If I can still find some guidance on returning swagger generated errors from controllers that would be a big help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions