Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to skip resolution of external references in Swagger files #33

Open
banshee86vr opened this issue Nov 20, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@banshee86vr
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently, the oasgen-provider always attempts to resolve external references ($ref) defined in Swagger files. This can cause issues when the external references are not accessible or intentionally left unresolved (e.g., for modular API definitions or when external dependencies are managed separately). There appears to be no way to skip this resolution process, which limits flexibility and may lead to failures in processing the Swagger file.

Describe the solution you'd like

I would like the ability to configure the oasgen-provider to skip the resolution of external references defined in Swagger files. This could be implemented by adding an option to the RestDefinition manifest, such as skipExternalRefs, that explicitly disables the resolution of external references.

Here is an example of how this configuration could look:

apiVersion: oasgen.krateo.io/v1alpha1
kind: RestDefinition
metadata:
  name: modular-api
spec:
  source:
    type: git
    url: https://github.com/your-org/your-repo
    branch: main
    path: /swagger.yaml
  options:
    skipExternalRefs: true

When skipExternalRefs is set to true, the oasgen-provider would process the Swagger file without attempting to resolve external references.

Describe alternatives you've considered

  1. Pre-processing the Swagger file: Modifying the Swagger file beforehand to remove or replace external references.

Additional context

  • Skipping external reference resolution can be particularly useful for modular Swagger designs where some parts of the API definition are dynamically managed or resolved at runtime.
  • If possible, the implementation could also allow logging or warnings about skipped references, helping users debug potential issues while keeping the resolution process optional.
@matteogastaldello matteogastaldello added the enhancement New feature or request label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants