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> | 			<h2>Response</h2> | ||||||
| 			<section v-for="status in Object.keys(ep.spec.responses)" :key="status"> | 			<section v-for="status in Object.keys(ep.spec.responses)" :key="status"> | ||||||
| 				<h3>{{ status }}</h3> | 				<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> | 		</section> | ||||||
| 		<section class="raw"> | 		<section class="raw"> | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| <div class=""> | <div class=""> | ||||||
| 	Array of | 	Array of | ||||||
| 	<div class=""> | 	<div class=""> | ||||||
| 		<XValue class="kv _vMargin _shadow" :value="array" :schemas="schemas"/> | 		<XValue class="" :value="array" :schemas="schemas"/> | ||||||
| 	</div> | 	</div> | ||||||
| </div> | </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
|  | @ -1,7 +1,8 @@ | ||||||
| <template> | <template> | ||||||
| <div class="jhpkzgfz"> | <div class="jhpkzgfz"> | ||||||
| 	<div class="kvs"> | 	<div class="kv" v-for="kv in kvs" :key="kv[0]"> | ||||||
| 		<XValue v-for="kv in kvs" :key="kv[0]" class="kv _vMargin _shadow" :name="kv[0]" :value="kv[1]" :schemas="schemas"/> | 		<div class="k _monospace">{{ kv[0] }}</div> | ||||||
|  | 		<XValue class="v" :value="kv[1]" :schemas="schemas"/> | ||||||
| 	</div> | 	</div> | ||||||
| </div> | </div> | ||||||
| </template> | </template> | ||||||
|  | @ -43,16 +44,27 @@ export default defineComponent({ | ||||||
| 
 | 
 | ||||||
| <style lang="scss" scoped> | <style lang="scss" scoped> | ||||||
| .jhpkzgfz { | .jhpkzgfz { | ||||||
| 	> .kvs { | 	border: solid 1px var(--divider); | ||||||
|  | 	border-radius: 4px; | ||||||
|  | 	padding: 16px; | ||||||
| 
 | 
 | ||||||
| 	> .kv { | 	> .kv { | ||||||
| 			::v-deep(.k) { | 		display: flex; | ||||||
| 				font-weight: bold; | 
 | ||||||
|  | 		&:not(:first-child) { | ||||||
|  | 			margin-top: 16px; | ||||||
|  | 			padding-top: 16px; | ||||||
|  | 			border-top: solid 1px var(--divider); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 			::v-deep(.v) { | 		> .k { | ||||||
| 				padding: 16px; | 			font-weight: bold; | ||||||
|  | 			margin-right: 1em; | ||||||
|  | 			min-width: 8em; | ||||||
| 		} | 		} | ||||||
|  | 
 | ||||||
|  | 		> .v { | ||||||
|  | 			flex: 1; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,18 +1,17 @@ | ||||||
| <template> | <template> | ||||||
| <MkContainer :body-togglable="true" class="ezkosiua"> | <div class="ezkosiua"> | ||||||
| 	<template #header> |  | ||||||
| 	<div class="header _monospace"> | 	<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> | 		<span class="type">{{ type }}</span> | ||||||
| 	</div> | 	</div> | ||||||
| 	</template> |  | ||||||
| 	<div class="body"> | 	<div class="body"> | ||||||
| 		<div class="description">{{ value.description }}</div> | 		<div class="description">{{ value.description }}</div> | ||||||
| 
 | 
 | ||||||
| 		<div v-if="value.$ref" class="ref"> | 		<div v-if="value.$ref" class="ref"> | ||||||
| 			<button class="_textButton" @click="resolveRef = true"> |  | ||||||
| 				{{ value.$ref.replace('#/components/schemas/', '') }} |  | ||||||
| 			</button> |  | ||||||
| 			<div v-if="resolveRef"> | 			<div v-if="resolveRef"> | ||||||
| 				<XValue :value="schemas[value.$ref.replace('#/components/schemas/', '')]" :schemas="schemas"/> | 				<XValue :value="schemas[value.$ref.replace('#/components/schemas/', '')]" :schemas="schemas"/> | ||||||
| 			</div> | 			</div> | ||||||
|  | @ -29,7 +28,7 @@ | ||||||
| 			unknown | 			unknown | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
| </MkContainer> | </div> | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
|  | @ -62,10 +61,6 @@ export default defineComponent({ | ||||||
| 			type: Object, | 			type: Object, | ||||||
| 			required: true | 			required: true | ||||||
| 		}, | 		}, | ||||||
| 		name: { |  | ||||||
| 			type: String, |  | ||||||
| 			required: false |  | ||||||
| 		}, |  | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	data() { | 	data() { | ||||||
|  | @ -82,14 +77,9 @@ export default defineComponent({ | ||||||
| 
 | 
 | ||||||
| <style lang="scss" scoped> | <style lang="scss" scoped> | ||||||
| .ezkosiua { | .ezkosiua { | ||||||
| 	::v-deep(.header) { | 	> .header { | ||||||
| 		> .name { | 		> .ref { | ||||||
| 			font-weight: bold; | 			margin-right: 8px; | ||||||
| 			margin-right: 1em; |  | ||||||
| 
 |  | ||||||
| 			&:empty { |  | ||||||
| 				display: none; |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		> .type { | 		> .type { | ||||||
|  | @ -99,8 +89,8 @@ export default defineComponent({ | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	::v-deep(.body) { | 	> .body { | ||||||
| 		padding: 16px; | 		margin-top: 8px; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| </style> | </style> | ||||||
|  |  | ||||||
|  | @ -8,7 +8,15 @@ import { schemas, convertSchemaToOpenApiSchema } from './schemas'; | ||||||
| import { getDescription } from './description'; | import { getDescription } from './description'; | ||||||
| 
 | 
 | ||||||
| export function genOpenapiSpecForEndpoint(endpoint: IEndpoint, lang = 'ja-JP') { | 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; }) { | 	function genProps(props: { [key: string]: Context; }) { | ||||||
| 		const properties = {} as any; | 		const properties = {} as any; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue