openapi-ts icon indicating copy to clipboard operation
openapi-ts copied to clipboard

Remote $ref support

Open bunnyxt opened this issue 1 year ago • 0 comments

Description

Hello team, I tried to generate code from a yaml spec file with $ref to a remote yaml file resource (e.g. hosted on raw.githubusercontent.com). Seems that openapi-ts does not support it yet. Could we support remote $ref?

For example, for the following local.yaml spec:

components:
  schemas:
    MyRequest:
      allOf:
        - $ref: 'https://raw.githubusercontent.com/user-name/repo-name/main/remote.yaml#/components/schemas/BaseRequest)'

In this case, openapi-ts could download remote.yaml file and generate BaseRequest type and schema for reference as well.

Edit: I found that even if $ref is pointing to a local yaml file, the BaseRequest type is not generated as expected, which maybe considered as a bug,

bunnyxt avatar Jun 27 '24 22:06 bunnyxt