Skip to content

Endpoints with only 3xx responses are rejected as invalid (no generated method) #413

@phlawski

Description

@phlawski

Description

When using openapi-processor-spring, operations that only declare redirect
responses (e.g. HTTP 302) are considered invalid and are not generated in the
Spring interface.

The processor reports an error similar to

endpoint '/logout' has no success 2xx response.

As a result, no method is generated for the endpoint.

Example OpenAPI

### Example OpenAPI

```yaml
/authorize:
  get:
    summary: OAuth2 authorize endpoint
    responses:
      '302':
        description: Redirect to authorization server
        headers:
          Location:
            schema:
              type: string

This OpenAPI definition is valid and accurately describes the runtime behavior:
the endpoint always responds with a redirect and never returns a 2xx response.

Actual behaviour:

  • The processor reports a validation error: endpoint has no success 2xx response
  • No method is generated in the Spring interface

Expected behaviour:

The processor should generate the endpoint method even if the operation only
defines 3xx responses.

Redirect-based endpoints are a valid and common HTTP pattern, especially in
browser-based flows such as:

  • OAuth2 /authorize
  • login / logout endpoints
  • SSO / identity provider redirects

Requiring an artificial 2xx response (e.g. a dummy 204) just to satisfy the
generator leads to OpenAPI specifications that do not accurately reflect
runtime behavior.

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