Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support URL versioning #495

Open
AquilaSands opened this issue Apr 26, 2021 · 0 comments
Open

Support URL versioning #495

AquilaSands opened this issue Apr 26, 2021 · 0 comments

Comments

@AquilaSands
Copy link

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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant