|
2 | 2 | import MethodBadge from './MethodBadge.svelte'; |
3 | 3 | import ApiSchema from './ApiSchema.svelte'; |
4 | 4 | import { renderMarkdown } from '../../utils/render-markdown.js'; |
5 | | - import { resolveRef } from './openapi-store.svelte.js'; |
| 5 | + import { |
| 6 | + operationRequiredScopes, |
| 7 | + resolveOperationParameters, |
| 8 | + resolveRef, |
| 9 | + } from './openapi-store.svelte.js'; |
6 | 10 |
|
7 | 11 | let { spec, entry } = $props(); |
8 | 12 |
|
9 | 13 | // entry = { tag, path, method, operation, id } |
10 | 14 | const op = $derived(entry.operation); |
11 | | - const params = $derived(op.parameters || []); |
| 15 | + const params = $derived(resolveOperationParameters(spec, entry)); |
12 | 16 | const grouped = $derived(groupParams(params)); |
| 17 | + const requiredScopes = $derived(operationRequiredScopes(op)); |
13 | 18 |
|
14 | 19 | function groupParams(list) { |
15 | 20 | const buckets = { path: [], query: [], header: [], cookie: [] }; |
|
82 | 87 | {#each Object.keys(req) as scheme} |
83 | 88 | <span class="security-pill"> |
84 | 89 | {scheme} |
85 | | - {#if req[scheme] && req[scheme].length > 0} |
86 | | - <span class="security-scopes">({req[scheme].join(', ')})</span> |
87 | | - {/if} |
88 | 90 | </span> |
89 | 91 | {/each} |
90 | 92 | {/each} |
| 93 | + {#if requiredScopes.length > 0} |
| 94 | + <span class="security-pill"> |
| 95 | + Required scopes |
| 96 | + <span class="security-scopes">({requiredScopes.join(', ')})</span> |
| 97 | + </span> |
| 98 | + {/if} |
91 | 99 | </div> |
92 | 100 | </section> |
93 | 101 | {/if} |
|
0 commit comments