spec icon indicating copy to clipboard operation
spec copied to clipboard

echoopenapi adaptor breaks with path parameters when request option is missing

Open InSantoshMahto opened this issue 1 year ago • 2 comments

Issue Summary

When using the echoopenapi adaptor, endpoints with path parameters fail to generate a default schema if option.Request is not provided. This breaks the expected behavior where a default schema should be generated for path parameters even without explicitly specifying a request option.

Example

type JustForDubugging struct {
    ID string `path:"id"`
}

router.DELETE("/:id", deleteHandler).With(
    option.Request(new(JustForDubugging)),
)

Expected:

  • When option.Request is not specified, the adaptor should still generate a default schema for the path parameter.

Actual:

  • The schema is not generated, causing issues with OpenAPI documentation and potentially client integrations.

Proposed Solution

  • Update the echoopenapi adaptor to detect path parameters and generate a default schema, even when option.Request is omitted.
  • Ensure backward compatibility so existing routes without explicit request options do not break.

Additional Context

  • This affects routes using path parameters when no request struct is provided via option.Request.
  • Might impact automated documentation and client code generation.

InSantoshMahto avatar Oct 31 '25 15:10 InSantoshMahto

echoopenapi is use spec for generating openapi doc, and spec is wrapper from openapi-go, as for error when not set request option at register operation is at openapi-go library, and for support this issue maybe can adjust at openapi-go repo first and then spec repo, or any other option?

akfaiz avatar Nov 04 '25 13:11 akfaiz

likely it possible with same mechanism like this pr, but i think if we support this method it must be added at spec not at adapter, so all adapter has this feature.

akfaiz avatar Nov 04 '25 15:11 akfaiz