Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

deep-linking.md 1.6 KiB

7 anos atrás
7 anos atrás
7 anos atrás
123456789101112131415161718192021222324252627282930313233343536
  1. # Deep linking
  2. Swagger-UI allows you to deeply link into tags and operations within a spec. When Swagger-UI is provided a URL fragment at runtime, it will automatically expand and scroll to a specified tag or operation.
  3. ## Usage
  4. 👉🏼 Add `deepLinking: true` to your Swagger-UI configuration to enable this functionality.
  5. When you expand a tag or operation, Swagger-UI will automatically update its URL fragment with a deep link to the item.
  6. Conversely, when you collapse a tag or operation, Swagger-UI will clear the URL fragment.
  7. You can also right-click a tag name or operation path in order to copy a link to that tag or operation.
  8. #### Fragment format
  9. The fragment is formatted in one of two ways:
  10. - `#/{tagName}`, to trigger the focus of a specific tag
  11. - `#/{tagName}/{operationId}`, to trigger the focus of a specific operation within a tag
  12. `operationId` is the explicit operationId provided in the spec, if one exists.
  13. Otherwise, Swagger-UI generates an implicit operationId by combining the operation's path and method, and escaping non-alphanumeric characters.
  14. ## FAQ
  15. > I'm using Swagger-UI in an application that needs control of the URL fragment. How do I disable deep-linking?
  16. This functionality is disabled by default, but you can pass `deepLinking: false` into Swagger-UI as a configuration item to be sure.
  17. > Can I link to multiple tags or operations?
  18. No, this is not supported.
  19. > Can I collapse everything except the operation or tag I'm linking to?
  20. Sure - use `docExpansion: none` to collapse all tags and operations. Your deep link will take precedence over the setting, so only the tag or operation you've specified will be expanded.