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

Regex matching does not seem to work as it should #1072

Open
AlexJFox opened this issue Jan 14, 2025 · 3 comments
Open

Regex matching does not seem to work as it should #1072

AlexJFox opened this issue Jan 14, 2025 · 3 comments

Comments

@AlexJFox
Copy link

I have the following methods/endpoints available in a subset of my api spec:
get /api/VoyageLogs
put /api/VoyageLogs
post /api/VoyageLogs
delete /api/VoyageLogs
get /api/VoyageLogs/Deleted
post /api/VoyageLogs/VERS

If I use Regex to try and match "^get /api/VoyageLogs$|^put /api/VoyageLogs$|^post /api/VoyageLogs$|^delete /api/VoyageLogs$" then no results are returned, and I would expect to see the first 4 in the list returned.

I have tried various methods to match these such as a non-capturing group i.e. ^(?:get|put|post|delete) /api/VoyageLogs$

I can use includes and "VoyageLogs" to retrieve these, but I have other methods where this isn't the solution as I need to match two distinct endpoints i.e. /api/HubReports & /api/HubTemplates.

Is there any further guidance on what regex can be used in mini-doc or is there a way to match multiple paths with "includes"?

Thanks

@mrin9
Copy link
Collaborator

mrin9 commented Jan 18, 2025

can you provide with the complete code for rapidoc component along with all the other attribute values ?

for instance the below config should achieve what u are looking for

  <rapi-doc-mini
    style= "width:600px; border-radius: 8px;"
    id = "thedoc" 
    spec-url="./specs/temp.yaml"
    match-paths = "^get /api/VoyageLogs$|^put /api/VoyageLogs$|^post /api/VoyageLogs$|^delete /api/VoyageLogs$"
    match-type = "regex"
  > </rapi-doc-mini>

@AlexJFox
Copy link
Author

Hi, here is the complete code:

<rapi-doc-mini 
    spec-url="https://uat-core-hub-api.misvetting.com/v1/guide"
    theme="light"
    paths-expanded="false"
    match-paths="^get /api/VoyageLogs$|^put /api/VoyageLogs$|^post /api/VoyageLogs$|^delete /api/VoyageLogs$"
    match-type="regex"
    allow-try="false"
>
<p slot="footer">See the <a href="../developers/api-reference-rapidoc.htm">API Reference</a> for full information.</p>
</rapi-doc-mini>

@mrin9
Copy link
Collaborator

mrin9 commented Jan 21, 2025

can you convert your spec from Swagger v2 to OpenAPI v3 and try it.

In the later version of RapiDoc we are using parsers which is more compliant with OpenAPI v3+ and have a reduced support for auto conversion of Swagger V2 to OpenAPI V3

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

2 participants