Skip to content

Bundler does not use user defined files #2797

@g-dimartino

Description

@g-dimartino

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:

  1. 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
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions