Skip to content

Filter unused OpenAPI definitions when extracting selected operations #343

Open

Description

@jazeem-ilyas77

Command that triggered the bug

apiops extract

Expected behavior

When extracting an API with an operation filter, the generated OpenAPI specification contains only the selected operations, but retains definitions used exclusively by excluded operations.

This can cause validation to fail on an unrelated definition. For example, Spectral reports an array-items error for an invalid schema even when the operation using it was excluded.

Expected behavior

Filter the definitions to those needed by the selected operations, while preserving all transitively referenced components.

Actual behavior

The extractor removes unselected operations from specification.yaml, but still extracts definitions that are not referenced by the selected operations. As a result, validation can fail on an invalid definition unrelated to the selected operations.

apiops CLI version

1.0.5

Environment details

Environment

APIOps CLI: 1.0.5
Command: apiops extract --filter
CI: Azure DevOps with Spectral validation

CI/CD environment

None

Is this bug blocking you?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions