Skip to content

Commit

Permalink
Merge pull request #25 from padiazg/fix-missing-description-for-opera…
Browse files Browse the repository at this point in the history
…tion

Fix operation "description" must be present and non-empty string.
  • Loading branch information
kaynetik authored Aug 18, 2022
2 parents acd137c + 472de0a commit 0973396
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func makeAllPathsMap(paths *Paths) pathsMap {
pathMap[keyTags] = path.Tags
pathMap[keySummary] = path.Summary
pathMap[keyOperationID] = path.OperationID
pathMap[keyDescription] = path.Description
pathMap[keySecurity] = makeSecurityMap(&path.Security)
pathMap[keyRequestBody] = makeRequestBodyMap(&path.RequestBody)
pathMap[keyResponses] = makeResponsesMap(&path.Responses)
Expand Down
4 changes: 2 additions & 2 deletions examples/api-documentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "github.com/go-oas/docs"
func handleCreateUserRoute(oasPathIndex int, oas *docs.OAS) {
path := oas.GetPathByIndex(oasPathIndex)

path.Summary = "Create a new User"
path.Description = "Create a new User"
path.OperationID = "createUser"

path.RequestBody = docs.RequestBody{
Expand Down Expand Up @@ -34,7 +34,7 @@ func handleCreateUserRoute(oasPathIndex int, oas *docs.OAS) {
func handleGetUserRoute(oasPathIndex int, oas *docs.OAS) {
path := oas.GetPathByIndex(oasPathIndex)

path.Summary = "Get a User"
path.Description = "Get a User"
path.OperationID = "getUser"
path.RequestBody = docs.RequestBody{}
path.Responses = docs.Responses{
Expand Down
1 change: 1 addition & 0 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type Path struct {
HTTPMethod string `yaml:"httpMethod"`
Tags []string `yaml:"tags"`
Summary string `yaml:"summary"`
Description string `yaml:"description"`
OperationID string `yaml:"operationId"`
RequestBody RequestBody `yaml:"requestBody"`
Responses Responses `yaml:"responses"`
Expand Down

0 comments on commit 0973396

Please sign in to comment.