Skip to content

feat: upgrade deps, new prefix option, cleaning and typos #15

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

GreyXor
Copy link

@GreyXor GreyXor commented Feb 22, 2024

Hello, this PR contains a few improvements:

  • An update of all dependencies
  • A few typographical corrections
  • use of any rather than interface{} or http.NoBody, rather than nil
  • A new prefix option

This new prefix option is useful when you have an API whose server spec contains a subfolder. In my case, it's /api. But as I register my api with server.RegisterHandlersWithBaseURL(s.EchoServer, server.NewStrictHandler(s.APIService.API, nil), "/api").
The prefix is not visible to the router, so the validator can't see it either. Setting this new option to /api virtually removes the prefix. And makes the validator work properly.

close: #11

@GreyXor GreyXor requested a review from a team as a code owner February 22, 2024 10:25
@GreyXor
Copy link
Author

GreyXor commented Jun 17, 2024

@jamietanna gentle ping, can I have your input here ?

@GreyXor
Copy link
Author

GreyXor commented Nov 29, 2024

@jamietanna hello ?

@jamietanna
Copy link
Member

Hey @GreyXor apologies for the delay!

Out of interest, how's your testing for this going so far? I've tried to take the Prefix functionality and add it into the net/http middleware, but it doesn't seem to be working - oapi-codegen/nethttp-middleware#40 doesn't correctly map the request URL path:

-want:
+got:
 # A request that is well-formed is passed through to the Handler
-POST /public-api/v1/resource was called
-Received an HTTP 204 response. Expected HTTP 204
+Received an HTTP 404 response. Expected HTTP 204
+Response body: no matching operation was found

@GreyXor
Copy link
Author

GreyXor commented Apr 25, 2025

Hello thanks,
yes my tests doing well. i'm using this since 1 year without any issues. working as expected to me. I'm not sure about your nethttp-middleware. I'll check later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Sub path support
2 participants