-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wangj
committed
May 13, 2022
1 parent
b266113
commit 96902f0
Showing
4 changed files
with
79 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Swagger from "types"; | ||
|
||
export function convert(swagger: Swagger) {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
type VALUE_TYPE_PRIMITIVE = "string" | "integer"; | ||
type VALUE_TYPE = | ||
| "array" | ||
| "boolean" | ||
| "integer" | ||
| "number" | ||
| "object" | ||
| "string" | ||
| "double" | ||
| "float" | ||
| "long"; | ||
type VALUE_FORMAT = "int64" | "int32"; | ||
|
||
export interface ObjectScheme { | ||
title?: string; | ||
description?: string; | ||
type?: VALUE_TYPE; | ||
enum?: string[]; | ||
format?: VALUE_FORMAT; | ||
properties?: { | ||
[key: string]: ObjectScheme; | ||
}; | ||
items?: ObjectScheme; | ||
$ref?: any; | ||
} | ||
export type Parameter = { | ||
name: string; | ||
in: "path" | "body" | "query" | "formData" | "header"; | ||
required?: boolean; | ||
description?: string; | ||
type?: VALUE_TYPE_PRIMITIVE; | ||
format?: VALUE_FORMAT; | ||
schema: ObjectScheme; | ||
}; | ||
|
||
interface Response { | ||
description: string; | ||
schema: ObjectScheme; | ||
} | ||
|
||
export interface SwaggerRequest { | ||
summary: string; | ||
description?: string; | ||
operationId: string; | ||
responses: { | ||
200: Response; | ||
default: Response; | ||
}; | ||
parameters: Array<Parameter>; | ||
} | ||
|
||
export interface SwaggerPath { | ||
get?: SwaggerRequest; | ||
post?: SwaggerRequest; | ||
put?: SwaggerRequest; | ||
delete?: SwaggerRequest; | ||
} | ||
|
||
export default interface Swagger { | ||
swagger: "2.0" | "3.0"; | ||
basePath?: string; | ||
info: { | ||
title: string; | ||
version: string; | ||
description?: string; | ||
}; | ||
paths: { | ||
[path: string]: SwaggerPath; | ||
}; | ||
definitions: { | ||
[definition: string]: ObjectScheme; | ||
}; | ||
} |