Skip to content

openapi: deal with error return types #7

Closed

Description

@ahl

We may do this in several PRs, but the end state should be that the various error types are well-captured for each endpoint. This will likely require us to think more carefully about the specific return types we want to expose to developers, the appropriate granularity, and the types of remediation we expect developers to take in the case of failures.

There are types of failures where we have more information:

  • we could provide detailed information about input validation failures
  • we could provide specific guidance about retries in the case of 503 (service unavailable)
  • etc.

Ideally we should make use of the components/responses field of OpenAPI to minimize the number of times these shared error structures are represented in the OpenAPI document.

Activity

  1. WasabiFan commented on Aug 10, 2021

    @WasabiFan

    Would it be correct to say that currently there is no way to output errors in the responses section of an endpoint's OpenAPI doc? (Even manually, barring postprocessing of the JSON structure.) Currently, it looks like only one possible response can be modeled in the registered routes.

  2. hawkw commented on Dec 4, 2024

    @hawkw
    Member

    I think #1180 fixed this! Endpoint handler functions can now return user-defined error types and they have response schemas generated in OpenAPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions