You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was thinking about routing and etc ...
I think approach code generate from swagger spec will be useful and fast.
Example this is swagger spec (this example can copy and see in swagger editor )
openapi: 3.0.3
info:
title: Swagger Petstore - OpenAPI 3.0
version: 1.0.11
servers:
- url: https://petstore3.swagger.io/api/v3
paths:
/user:
get:
tags:
- user
summary: Get user by user name
description: ''
operationId: getUserByName3
responses:
'200':
description: successful operation
content:
text/html:
schema:
type: string
/user/{username}:
get:
tags:
- user
summary: Get user by user name
description: ''
operationId: getUserByName
parameters:
- name: username
in: path
description: 'The name that needs to be fetched. Use user1 for testing. '
required: true
schema:
type: string
- name: id
in: query
schema:
type: number
responses:
'200':
description: successful operation
content:
text/html:
schema:
type: string
/foo/{username}/boo:
get:
tags:
- user
summary: Get user by user name
description: ''
operationId: fooUsername
parameters:
- name: username
in: path
description: 'The name that needs to be fetched. Use user1 for testing. '
required: true
schema:
type: string
- name: id
in: query
schema:
type: number
responses:
'200':
description: successful operation
content:
text/html:
schema:
type: string
From this spec will be generated this files
# this files will always autogenerated
root.vue #main root
user.vue
user/[username].vue
foo/[username]/boo.vue
swaggergen # type of query params and etc
And file /root.vue will contain this content, and can be modify, can add header footer etc
<template>
<header> foo boo </header>
<view> -- can be empty
</template>
<scriptlang="ts"setup>import { typerootParams } from"@/swaggergen"const props =defineProps<{ params:rootParams}>()</script>
And for this approach have more idea. Example if path required auth swagger authentication
will generated middleware, where can write logic for check auth etc
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I was thinking about routing and etc ...
I think approach code generate from swagger spec will be useful and fast.
Example this is swagger spec (this example can copy and see in swagger editor )
From this spec will be generated this files
And file /root.vue will contain this content, and can be modify, can add header footer etc
user.vue
file foredit/user/[username].vue
etc ...
And for this approach have more idea. Example if path required auth swagger authentication
will generated middleware, where can write logic for check auth etc
Beta Was this translation helpful? Give feedback.
All reactions