wip
This commit is contained in:
		
							parent
							
								
									e5107f47cf
								
							
						
					
					
						commit
						10c1e8161f
					
				
					 5 changed files with 48 additions and 38 deletions
				
			
		|  | @ -13,7 +13,7 @@ | |||
| 			<h2>Response</h2> | ||||
| 			<section v-for="status in Object.keys(ep.spec.responses)" :key="status"> | ||||
| 				<h3>{{ status }}</h3> | ||||
| 				<XValue :value="ep.spec.responses[status].content['application/json'].schema" :schemas="ep.schemas"/> | ||||
| 				<XValue v-if="ep.spec.responses[status].content" :value="ep.spec.responses[status].content['application/json'].schema" :schemas="ep.schemas"/> | ||||
| 			</section> | ||||
| 		</section> | ||||
| 		<section class="raw"> | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| <div class=""> | ||||
| 	Array of | ||||
| 	<div class=""> | ||||
| 		<XValue class="kv _vMargin _shadow" :value="array" :schemas="schemas"/> | ||||
| 		<XValue class="" :value="array" :schemas="schemas"/> | ||||
| 	</div> | ||||
| </div> | ||||
| </template> | ||||
|  |  | |||
|  | @ -1,7 +1,8 @@ | |||
| <template> | ||||
| <div class="jhpkzgfz"> | ||||
| 	<div class="kvs"> | ||||
| 		<XValue v-for="kv in kvs" :key="kv[0]" class="kv _vMargin _shadow" :name="kv[0]" :value="kv[1]" :schemas="schemas"/> | ||||
| 	<div class="kv" v-for="kv in kvs" :key="kv[0]"> | ||||
| 		<div class="k _monospace">{{ kv[0] }}</div> | ||||
| 		<XValue class="v" :value="kv[1]" :schemas="schemas"/> | ||||
| 	</div> | ||||
| </div> | ||||
| </template> | ||||
|  | @ -43,16 +44,27 @@ export default defineComponent({ | |||
| 
 | ||||
| <style lang="scss" scoped> | ||||
| .jhpkzgfz { | ||||
| 	> .kvs { | ||||
| 	border: solid 1px var(--divider); | ||||
| 	border-radius: 4px; | ||||
| 	padding: 16px; | ||||
| 
 | ||||
| 	> .kv { | ||||
| 			::v-deep(.k) { | ||||
| 				font-weight: bold; | ||||
| 		display: flex; | ||||
| 
 | ||||
| 		&:not(:first-child) { | ||||
| 			margin-top: 16px; | ||||
| 			padding-top: 16px; | ||||
| 			border-top: solid 1px var(--divider); | ||||
| 		} | ||||
| 
 | ||||
| 			::v-deep(.v) { | ||||
| 				padding: 16px; | ||||
| 		> .k { | ||||
| 			font-weight: bold; | ||||
| 			margin-right: 1em; | ||||
| 			min-width: 8em; | ||||
| 		} | ||||
| 
 | ||||
| 		> .v { | ||||
| 			flex: 1; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -1,18 +1,17 @@ | |||
| <template> | ||||
| <MkContainer :body-togglable="true" class="ezkosiua"> | ||||
| 	<template #header> | ||||
| <div class="ezkosiua"> | ||||
| 	<div class="header _monospace"> | ||||
| 			<span class="name">{{ name }}</span> | ||||
| 		<span v-if="value.$ref" class="ref"> | ||||
| 			<button class="_textButton" @click="resolveRef = true"> | ||||
| 				{{ value.$ref.replace('#/components/schemas/', '') }} | ||||
| 			</button> | ||||
| 		</span> | ||||
| 		<span class="type">{{ type }}</span> | ||||
| 	</div> | ||||
| 	</template> | ||||
| 	<div class="body"> | ||||
| 		<div class="description">{{ value.description }}</div> | ||||
| 
 | ||||
| 		<div v-if="value.$ref" class="ref"> | ||||
| 			<button class="_textButton" @click="resolveRef = true"> | ||||
| 				{{ value.$ref.replace('#/components/schemas/', '') }} | ||||
| 			</button> | ||||
| 			<div v-if="resolveRef"> | ||||
| 				<XValue :value="schemas[value.$ref.replace('#/components/schemas/', '')]" :schemas="schemas"/> | ||||
| 			</div> | ||||
|  | @ -29,7 +28,7 @@ | |||
| 			unknown | ||||
| 		</div> | ||||
| 	</div> | ||||
| </MkContainer> | ||||
| </div> | ||||
| </template> | ||||
| 
 | ||||
| <script lang="ts"> | ||||
|  | @ -62,10 +61,6 @@ export default defineComponent({ | |||
| 			type: Object, | ||||
| 			required: true | ||||
| 		}, | ||||
| 		name: { | ||||
| 			type: String, | ||||
| 			required: false | ||||
| 		}, | ||||
| 	}, | ||||
| 
 | ||||
| 	data() { | ||||
|  | @ -82,14 +77,9 @@ export default defineComponent({ | |||
| 
 | ||||
| <style lang="scss" scoped> | ||||
| .ezkosiua { | ||||
| 	::v-deep(.header) { | ||||
| 		> .name { | ||||
| 			font-weight: bold; | ||||
| 			margin-right: 1em; | ||||
| 
 | ||||
| 			&:empty { | ||||
| 				display: none; | ||||
| 			} | ||||
| 	> .header { | ||||
| 		> .ref { | ||||
| 			margin-right: 8px; | ||||
| 		} | ||||
| 
 | ||||
| 		> .type { | ||||
|  | @ -99,8 +89,8 @@ export default defineComponent({ | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	::v-deep(.body) { | ||||
| 		padding: 16px; | ||||
| 	> .body { | ||||
| 		margin-top: 8px; | ||||
| 	} | ||||
| } | ||||
| </style> | ||||
|  |  | |||
|  | @ -8,7 +8,15 @@ import { schemas, convertSchemaToOpenApiSchema } from './schemas'; | |||
| import { getDescription } from './description'; | ||||
| 
 | ||||
| export function genOpenapiSpecForEndpoint(endpoint: IEndpoint, lang = 'ja-JP') { | ||||
| 	const locale = yaml.safeLoad(fs.readFileSync(__dirname + `/../../../api-docs/${lang}/` + endpoint.name + '.yml', 'utf-8')); | ||||
| 	let locale; | ||||
| 
 | ||||
| 	try { | ||||
| 		locale = yaml.safeLoad(fs.readFileSync(__dirname + `/../../../api-docs/${lang}/` + endpoint.name + '.yml', 'utf-8')); | ||||
| 	} catch (e) { | ||||
| 		locale = { | ||||
| 			params: {} | ||||
| 		}; | ||||
| 	} | ||||
| 
 | ||||
| 	function genProps(props: { [key: string]: Context; }) { | ||||
| 		const properties = {} as any; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue