Skip to content

GET /v3/apps/:guid/routes accepts include but ignores it #5560

Open

Description

@norman-abramovitz

GET /v3/routes?include=domain returns the domains under included; GET /v3/apps/:guid/routes?include=domain returns 200 with no included at all.

Both actions build a RoutesListMessage, which allows and validates include (routes_list_message.rb:12,19):

validates_with IncludeParamValidator, valid_values: ['domain', 'space', 'space.organization', 'route_policies']

index turns it into decorators (routes_controller.rb:46-50):

decorators = []
decorators << IncludeRouteDomainDecorator if IncludeRouteDomainDecorator.match?(message.include)
decorators << IncludeSpaceDecorator if IncludeSpaceDecorator.match?(message.include)
decorators << IncludeOrganizationDecorator if IncludeOrganizationDecorator.match?(message.include)
decorators << IncludeRoutePoliciesDecorator if IncludeRoutePoliciesDecorator.match?(message.include)

index_by_app (routes_controller.rb:299-327) validates the same message and renders PaginatedListPresenter without decorators:, so a valid include is accepted and dropped.

The v3 docs for this endpoint don't list include (routes/_list_for_app.md.erb), so either fix is consistent with them: apply the same decorators in index_by_app (and document include), or reject include there. Applying them seems the expected behaviour, since every other route list supports it. Happy to send a PR for whichever you prefer.

Found with a contract check of the v3 docs, the OpenAPI spec and the request messages (see #5496).

Activity

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