Skip to content

Support URL versioning #495

@AquilaSands

Description

@AquilaSands

When an API includes versioning in the URL this prevents httprepl listing endpoints.

With an OpenAPI description of

{
  "openapi": "3.0.1",
  "info": {
    "title": "Some API",
    "description": "A url versioned API.",
    "version": "v1"
  },
  "paths": {
    "/api/v{version}/weatherforecast": {
      "get": {
        "tags": [
          "WeatherForecast"
        ],
        "summary": "Gets a list of weather forecasts.",
        "operationId": "GetForecasts",
        "parameters": [
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ], 
...

When connected to httprepl this results in the following output

https://localhost:5001/api> ls
.            []
..           []
v{version}   []

https://localhost:5001/api> cd v1
Warning: The '/api/v1' endpoint is not present in the OpenAPI description
/api/v1    []

https://localhost:5001/api/v1> ls
.    []
..   []

This only affects the discoverability as the calls can still be made and it is possible to work around the issue by navigating to the placeholder to discover endpoints e.g.

https://localhost:5001/api> cd v{version}
/api/v{version}    []

https://localhost:5001/api/v{version}> ls
.                 []
..                []
weatherforecast   [GET|POST]

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