-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
referencing a schema from another file breaks nswag if that schema has an internal ref #2536
Copy link
Copy link
Open
Labels
Description
If I try to use NSwag with a spec that references a schema from another spec, but the referenced schema uses an internal $ref then NSwag crashes with the following error:
Unhandled Exception: System.InvalidOperationException: Could not resolve the path '#/components/schemas/Owner
here's an example set of specs i'm using:
# spec-a.yaml
openapi: 3.0.0
paths: {}
components:
schemas:
Home:
type: object
additionalProperties: false
required:
- name
- owner
properties:
name:
type: string
owner:
$ref: '#/components/schemas/Owner'
Owner:
type: object
additionalProperties: false
required:
- name
properties:
name:
type: string
# spec-b.yaml
openapi: 3.0.0
paths: {}
components:
schemas:
Thing:
type: object
additionalProperties: false
required:
- home
properties:
home:
$ref: './spec-a.yaml#/components/schemas/Home'
Reactions are currently unavailable