Skip to content

Relative paths in $ref to external files are not resolved correctly #260

@kazukinagata

Description

@kazukinagata

Description

When referencing split files with the same name located in different directories using relative paths, the issue arises at this line, where URLs are treated as duplicates. As a result, the correct type definitions are not generated.

Do you have plans to fix this issue? If not, I would be happy to submit a PR includes the necessary fixes and tests.

Thank you for this amazing library!

samples/nested-relative-refs/
├── index.yaml
├── models
│   ├── metadata.yaml
│   └── user.yaml
└── requests
    ├── metadata.yaml
    └── user.yaml
# samples/nested/relative-refs/models/user.yaml
title: User
description: User model
type: object
xml:
  name: User
properties:
  name:
    type: string
  metadata:
    $ref: './metadata.yaml'
required:
  - name
  - metadata
# samples/nested/relative-refs/requests/user.yaml
title: UserRequest
description: User request
type: object
xml:
  name: UserRequest
properties:
  name:
    type: string
  metadata:
    $ref: './metadata.yaml'

Environment

  • Package version: v0.24.0
  • OS:
    • Linux
    • Windows
    • macOS
  • Node.js version: 18.20.4
  • npm version: 10.7.0

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions