Skip to content

Commit

Permalink
openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
Artanis-c committed Jan 17, 2024
1 parent 3e8ed66 commit f4f20c3
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/swagger/swagger_components.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package swagger
22 changes: 22 additions & 0 deletions pkg/swagger/swagger_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package swagger

// Info swagger info 根节点/**
type Info struct {
Title string `json:"title"`
Description string `json:"description"`
TermsOfService string `json:"termsOfService"`
Contact Contact `json:"contact"`
License License `json:"license"`
Version string `json:"version"`
}

type Contact struct {
Name string `json:"name"`
Url string `json:"url"`
Email string `json:"email"`
}

type License struct {
Name string `json:"name"`
Url string `json:"url"`
}
47 changes: 47 additions & 0 deletions pkg/swagger/swagger_path.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package swagger

type Path struct {
Tags []string `json:"tags"`
Summary string `json:"summary"`
OperationId string `json:"operationId"`
Parameters []Parameters `json:"parameters"`
RequestBody RequestBody `json:"requestBody"`
Responses map[string]ResponsesItem `json:"responses"`
Security []Security `json:"security"`
}

type Parameters struct {
Name string `json:"name"`
In string `json:"in"`
Description string `json:"description"`
Required bool `json:"required"`
Schema struct {
Type string `json:"type"`
} `json:"schema"`
}
type RequestBody struct {
Content map[string]ContentType `json:"content"`
}

type ContentType struct {
Schema Schema `json:"schema"`
}

type Schema struct {
Type string `json:"type"`
Properties map[string]Property `json:"properties"`
Required []string `json:"required"`
}
type Property struct {
Description string `json:"description"`
Type string `json:"type"`
}

type ResponsesItem struct {
Description string `json:"description"`
Content map[string]interface{} `json:"content"`
}

type Security struct {
PetstoreAuth []string `json:"petstore_auth"`
}

0 comments on commit f4f20c3

Please sign in to comment.