@@ -7,6 +7,7 @@ import SourceView from '../../SourceView.vue'
77import { usePrettyLanguage } from ' @/composables/usePrettyLanguage'
88import { Tooltip } from ' bootstrap' ;
99
10+ declare type Tab = ' RequestBody' | ' Parameters' | ' Security'
1011const { formatSchema } = usePrettyLanguage ()
1112
1213const props = defineProps <{
@@ -70,6 +71,15 @@ const hasOneSecurityScheme = computed(() => {
7071 }
7172 return false
7273})
74+ const activeTab = computed <Tab >(() => {
75+ if (props .operation .requestBody ) {
76+ return ' RequestBody' ;
77+ }
78+ if (props .operation .parameters || ! props .operation .security ) {
79+ return ' Parameters' ;
80+ }
81+ return ' Security'
82+ })
7383function getSchemeClass(scheme : HttpSecurityScheme ) {
7484 switch (scheme .configs [' type' ]) {
7585 case ' http' :
@@ -86,20 +96,30 @@ function getSchemeClass(scheme: HttpSecurityScheme) {
8696 <h2 id =" request" class =" card-title text-center" >Request</h2 >
8797
8898 <div class =" nav card-tabs" role =" tablist" data-testid =" tabs" >
89- <button :class =" operation.requestBody ? 'active' : 'disabled'" id =" body-tab" :aria-disabled =" !operation.requestBody" data-bs-toggle =" tab" data-bs-target =" #body" type =" button" role =" tab" aria-controls =" body" aria-selected =" true " ><span class =" bi-file-text me-2" />Body</button >
90- <button :class =" operation.parameters ? (operation.requestBody ? '' : 'active') : 'disabled' " id =" parameters-tab" :aria-disabled = " !operation.parameters " data-bs-toggle =" tab" data-bs-target =" #parameters" type =" button" role =" tab" aria-controls =" parameters" aria-selected =" false " ><span class =" bi-sliders me-2" />Parameters</button >
91- <button :class =" operation.security ? (operation.requestBody || operation.parameters ? '' : 'active') : 'disabled' " id =" security-tab" :aria-disabled =" !operation.security" data-bs-toggle =" tab" data-bs-target =" #security" type =" button" role =" tab" aria-controls =" security" aria-selected =" false " ><span class =" bi-shield-lock me-2" /> Security</button >
99+ <button :class =" activeTab === 'RequestBody' ? 'active' : 'disabled'" id =" body-tab" :aria-disabled =" !operation.requestBody" data-bs-toggle =" tab" data-bs-target =" #body" type =" button" role =" tab" aria-controls =" body" : aria-selected =" activeTab === 'RequestBody' " ><span class =" bi-file-text me-2" />Body</button >
100+ <button :class =" { active: activeTab === 'Parameters' } " id =" parameters-tab" data-bs-toggle =" tab" data-bs-target =" #parameters" type =" button" role =" tab" aria-controls =" parameters" : aria-selected =" activeTab === 'Parameters' " ><span class =" bi-sliders me-2" />Parameters</button >
101+ <button :class =" { active: activeTab === 'Security', disabled: !operation.security } " id =" security-tab" :aria-disabled =" !operation.security" data-bs-toggle =" tab" data-bs-target =" #security" type =" button" role =" tab" aria-controls =" security" : aria-selected =" activeTab === 'Security' " ><span class =" bi-shield-lock me-2" /> Security</button >
92102 </div >
93103
94104 <div class =" tab-content" id =" tabRequest" >
95105 <div class =" tab-pane fade" :class =" operation.requestBody ? 'show active' : ''" id =" body" role =" tabpanel" aria-labelledby =" body-tab" v-if =" operation.requestBody" >
96106 <div v-if =" operation.requestBody" >
97- <p class =" label" v-if =" operation.requestBody.description" >Description</p >
98- <p v-if =" operation.requestBody.description" >{{ operation.requestBody.description }}</p >
99- <p v-if =" operation.requestBody.required" >Required</p >
100-
101- <p class =" label" v-if =" operation.requestBody.contents.length == 1" >Request content type</p >
102- <p v-if =" operation.requestBody.contents.length == 1" >{{ operation.requestBody.contents[0]?.type }}</p >
107+ <div class =" row mb-2" v-if =" operation.requestBody.description" >
108+ <div class =" col" >
109+ <p class =" label" >Description</p >
110+ <p >{{ operation.requestBody.description }}</p >
111+ </div >
112+ </div >
113+ <div class =" row mb-2" >
114+ <div class =" col-2" >
115+ <p class =" label" v-if =" operation.requestBody.contents.length == 1" >Request content type</p >
116+ <p v-if =" operation.requestBody.contents.length == 1" >{{ operation.requestBody.contents[0]?.type }}</p >
117+ </div >
118+ <div class =" col" >
119+ <p class =" label" >Required</p >
120+ <p >{{ operation.requestBody.required }}</p >
121+ </div >
122+ </div >
103123
104124 <source-view
105125 :source =" { preview: { content: formatSchema(selected.content?.schema), contentType: 'application/json' }}"
0 commit comments