I have this file structure in my project:
src/
├── index.yaml (Root OpenAPI definition)
├── info/
│ ├── index.yaml (API Metadata: title, version)
│ ├── contact.yaml (Contact information)
│ └── license.yaml (License information)
├── servers/
│ └── index.yaml (Server configuration, default: http://localhost:8080)
├── security/
│ └── index.yaml (Global security requirements: bearerAuth)
├── tags/
│ └── index.yaml (Tag definitions)
├── components/
│ ├── index.yaml (Entry point for components)
│ ├── callbacks/
│ │ └── index.yaml
│ ├── examples/
│ │ └── index.yaml
│ ├── links/
│ │ └── index.yaml
│ ├── securitySchemes/
│ │ ├── index.yaml
│ │ └── bearerAuth.yaml (JWT scheme definition)
│ ├── headers/
│ │ ├── index.yaml
│ │ └── auth/
│ │ └── TenantHeader.yaml (Tenant header definition)
│ ├── parameters/
│ │ ├── index.yaml
│ │ ├── path/ (Path items definitions)
│ │ └── query/ (Query items definitions)
│ ├── requestBodies/
│ │ ├── index.yaml
│ │ ├── [...] (Request bodies definitions)
│ ├── responses/
│ │ ├── index.yaml
│ │ ├── common/ (Standard errors: 400, 401, 404, 500, etc.)
│ │ ├── [...]/ (Responses definitions)
│ └── schemas/
│ ├── index.yaml
│ ├── models/ (Entities definitions)
│ └── requests/ (Payloads for commands definitions)
└── paths/
├── index.yaml (Endpoint mapping)
└── [...]/ (Routes definitions)
When I run the bundle command, though, it doesn't read my "barrel files" (the index.yaml in each folder) but it creates its own object in components starting from the path reference and naming them with the file name.
Steps to reproduce the behavior:
- Root index should contain
components:
$ref: ./components/index.yaml
and that file should contain
schemas:
$ref: ./schemas/index.yaml
this file should have an object structure, like:
ObjectModel:
$ref: ./ObjectName.yaml
- Run bundle command
I would expect the bundled definition to contain 'ObjectModel' (as defined in my schema file); but it rather contains 'ObjectName' (taking it from the referenced file name).
services:
bundle:
image: redocly/cli:latest
volumes:
- ./:/spec
working_dir: /spec
command: bundle /spec/src/index.yaml -o openapi.yaml
I have this file structure in my project:
src/
├── index.yaml (Root OpenAPI definition)
├── info/
│ ├── index.yaml (API Metadata: title, version)
│ ├── contact.yaml (Contact information)
│ └── license.yaml (License information)
├── servers/
│ └── index.yaml (Server configuration, default: http://localhost:8080)
├── security/
│ └── index.yaml (Global security requirements: bearerAuth)
├── tags/
│ └── index.yaml (Tag definitions)
├── components/
│ ├── index.yaml (Entry point for components)
│ ├── callbacks/
│ │ └── index.yaml
│ ├── examples/
│ │ └── index.yaml
│ ├── links/
│ │ └── index.yaml
│ ├── securitySchemes/
│ │ ├── index.yaml
│ │ └── bearerAuth.yaml (JWT scheme definition)
│ ├── headers/
│ │ ├── index.yaml
│ │ └── auth/
│ │ └── TenantHeader.yaml (Tenant header definition)
│ ├── parameters/
│ │ ├── index.yaml
│ │ ├── path/ (Path items definitions)
│ │ └── query/ (Query items definitions)
│ ├── requestBodies/
│ │ ├── index.yaml
│ │ ├── [...] (Request bodies definitions)
│ ├── responses/
│ │ ├── index.yaml
│ │ ├── common/ (Standard errors: 400, 401, 404, 500, etc.)
│ │ ├── [...]/ (Responses definitions)
│ └── schemas/
│ ├── index.yaml
│ ├── models/ (Entities definitions)
│ └── requests/ (Payloads for commands definitions)
└── paths/
├── index.yaml (Endpoint mapping)
└── [...]/ (Routes definitions)
When I run the bundle command, though, it doesn't read my "barrel files" (the index.yaml in each folder) but it creates its own object in components starting from the path reference and naming them with the file name.
Steps to reproduce the behavior:
components:
$ref: ./components/index.yaml
and that file should contain
schemas:
$ref: ./schemas/index.yaml
this file should have an object structure, like:
ObjectModel:
$ref: ./ObjectName.yaml
I would expect the bundled definition to contain 'ObjectModel' (as defined in my schema file); but it rather contains 'ObjectName' (taking it from the referenced file name).
services:
bundle:
image: redocly/cli:latest
volumes:
- ./:/spec
working_dir: /spec
command: bundle /spec/src/index.yaml -o openapi.yaml