Skip to content

Two schemas are referenced with the same name but different content. Renamed Item to Item-2. #661

@colinmollenhour

Description

@colinmollenhour

If using subdirectories to organize a large number of components and some of these components share the same file basename (but exist in different subdirectories) you get warnings like this:

[6] paths/beta/rating/merchantRates.yaml:59:7 at #/get/parameters/3

Two schemas are referenced with the same name but different content. Renamed fields to fields-5.

This also comes up with models like models/Order/Item.yaml and models/Shipment/Item.yaml because both files are named Item so they are merged in as Item and Item-2 and so-on.

Example spec

openapi.yaml

openapi: 3.0.3
info:
  title: test
paths:
  '/api/global/beta/rating/rateGroups':
    $ref: 'paths/beta/rating/rateGroups.yaml'
  '/api/global/beta/rating/merchantRates':
    $ref: 'paths/beta/rating/merchantRates.yaml'

paths/beta/rating/rateGroups.yaml

get:
  summary: List all Rate Groups
  description: foo
  parameters:
    - $ref: ../../../components/parameters/rate/group/fields.yaml

paths/beta/rating/merchantRates.yaml

get:
  summary: List all Merchant Rates
  description: foo
  parameters:
    - $ref: ../../../components/parameters/merchant/rate/fields.yaml

Expected behavior
The refs are valid so ideally there should not be such warnings and ideally it should not require the refs to be declared explicitly in the top level file as a workaround as that is much more tedious than just directly referencing the files where they are needed.

openapi-cli Version(s)
1.0.0-beta.73

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions