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

How to split Path Item Object into seperate yaml file ? #115

Open
DevDengChao opened this issue Jan 18, 2024 · 2 comments
Open

How to split Path Item Object into seperate yaml file ? #115

DevDengChao opened this issue Jan 18, 2024 · 2 comments

Comments

@DevDengChao
Copy link

As a real-world project gose on, the number of paths grows, and the single yaml file becomes bigger, which lead to a slow loading when the swagger-ui js is trying to load a full yaml file.

I'd like to known how to spilt Path Item Object into seperate yaml files, but also keeps the auto-complete suggestion provided by any IDE, is there any official suggestions / guides / examples ?

  • IDEA uses schema store's open api schema to provide auto-complete suggestion.
@IvanovIlya116
Copy link

To split the Path Item object into separate YAML files while maintaining autocomplete suggestions in IDEs like IDEA, you can follow these steps:

  1. Separate paths into individual files: create separate YAML files for each endpoint or groups of endpoints. For example, you could have files like user.yaml, product.yaml, order.yaml, etc., each containing the definitions for their respective paths.

  2. Utilize references: in your main Swagger YAML file, use references to these separate files containing path definitions. For instance:

paths:
$ref: 'user.yaml'
$ref: 'product.yaml'
$ref: 'order.yaml'

  1. JSON references: you can also utilize JSON References to reference external files containing path definitions. This allows for a more flexible project structure and easier maintenance.

  2. configure IDE for autocomplete: Configure your IDE settings to point to the OpenAPI schema from schema store to enable autocomplete suggestions for your YAML files. This will allow the IDE to provide prompts for keywords, data structures, and other OpenAPI specification elements within your files.

For example, In IntelliJ IDEA you can find various settings for autocompletion and hints. Open the Settings window (File > Settings) and review the editor and autocompletion sections.

Here is the documentation - https://www.jetbrains.com/help/idea/auto-completing-code.html

@DevDengChao
Copy link
Author

@IvanovIlya116 Thanks, I'll give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants