Skip to content

Add files support to $ref #454

Closed
Closed
@roman-savitski

Description

@roman-savitski

Not sure whether this is not working or I'm doing something wrong. But if my $ref points to another file - result interfaces generated incorrectly.

Example:
api.yaml

openapi: 3.0.0
info:
  title: Test
  version: '1.0'
paths:
  '/my-api':
    get:
      responses:
        '200':
          description: Test command
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MyModel'
components:
  schemas:
    MyModel:
      $ref: ./api-model.yaml

api-model.yaml

title: My Model
type: object
properties:
  myModelProperty:
    type: string

I run openapi --input api.yaml --output ./dist

As result I'm getting ./dist/models/MyModel.ts

import type { api_model_yaml } from './api_model_yaml';

export type MyModel = api_model_yaml;

There is no api_model_yaml obviously. So idea of keeping models in separate files - failed. Could you please suggest me solution of this problem?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions