rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

Problem with OAuth 2.0 using refs for client credentials #1044

Closed yevhen-kovtun closed 1 month ago

yevhen-kovtun commented 1 month ago

Hi, we use refs for get client credentials in OAuth 2.0 security scheme. In RapiDoc 9.3.4 this works well. After updating to v9.3.7/v9.3.8 referenced file is not used and functionality doesn't work.

Could you pls advise me what could be the reason of this changes and how we could fix it for using new versions of RapiDoc.

yevhen-kovtun commented 1 month ago

after small research we found out that using different openapi version lead to different results. If we use openapi v3.0.3 everything works well as before, but with v3.1.0 rapidoc doesn't get referenced file and as result doesn't use it. Here is file example:

openapi: 3.1.0
info:
  version: '1.0'
  title: External refs (json-pointers)

paths:
  /external-refs:
    get:
      summary: External Refs
      description: Using external refs in spec
      responses:
        '200':
          content:
            application/json:
              schema:
components:
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          $ref: 'openapi-vars.yaml#/OAuthFlows/clientCredentials'
security:
  - OAuth2: []
mrin9 commented 1 month ago

in later versions of RapiDoc v9.3.4 we have updated our OpenAPI parsers to be more compliant with OpenAPI 3.1.0 This could be an issue.

Also do you know in OpenAPI 3.1.0, refs are not allowed in everyplace but only in certain location please refer this issue comment if its related.

Please feel to close the issue if it solves your case or add ur findings

yevhen-kovtun commented 1 month ago

thank you for clarification, issue closed.