Giter Site home page Giter Site logo

Comments (6)

shibayan avatar shibayan commented on June 6, 2024 1

@justinyoo

I tried the same route with the ASP.NET Core Web API with Swashbuckle, and it worked. Looking at the generated openapi definition, it seems that "*" should not be included in the definition.

[Route("api/[controller]")]
[ApiController]
public class ValuesController : ControllerBase
{
    [HttpGet("{*path}")]
    public ActionResult Get(string path)
    {
        return Ok(path);
    }
}
{
  "openapi": "3.0.1",
  "info": {
    "title": "WebApplication6",
    "version": "v1"
  },
  "paths": {
    "/api/Values/{path}": {
      "get": {
        "tags": [
          "Values"
        ],
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "nullable": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    }
  },
  "components": { }
}

from azure-functions-openapi-extension.

justinyoo avatar justinyoo commented on June 6, 2024

@shibayan Thanks for the issue! The actual function endpoint itself works fine, if you send a request directly to the endpoint like:

curl http://localhost:7071/api/catchall/hello/world

However, like you mentioned, I can confirm that it doesn't work on the UI as expected. I'm not sure it's the issue on my end or the UI's end.

Have you got the similar experience with Swagger UI on other application like ASP.NET Core Web API with Swashbuckle?

from azure-functions-openapi-extension.

justinyoo avatar justinyoo commented on June 6, 2024

Thanks for confirming! Let me have a look.

from azure-functions-openapi-extension.

justinyoo avatar justinyoo commented on June 6, 2024

@shibayan I looked at the issue. However, if the wildcard character is omitted, it actually changes the semantics of the endpoint. In other words, the following path template implies the {*path} can be hello, hello/world or hello/world/lorem/ipsum.

/catchall/{*path}

But the following path template implies the {path} can only be hello or world, not hello/world

/catchall/{path}

I can change the path template from /catchall/{*path} to /catchall/{path} so that the OpenAPI doc shows the latter but, like I said, it changes semantics. Even though I applied the change to Swagger UI, it doesn't work properly either. It should be the UI's issue, not ours.

image

image

image

image

from azure-functions-openapi-extension.

shibayan avatar shibayan commented on June 6, 2024

@justinyoo Thanks for the reply. I don't think the URL encoding of parameters is a Swagger UI issue, so I don't think it needs to be addressed, but I think the "catch all" parameter not being included in the OpenAPI definition is another issue.

from azure-functions-openapi-extension.

justinyoo avatar justinyoo commented on June 6, 2024

@shibayan Yeah, it's not something I can do on my end. If you Google it, there are so many discussions around - from the spec wise to the implementation perspective.

I'm not too sure, we can get it through the proxies.json file. Let me try.

from azure-functions-openapi-extension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.