Skip to content

Commit

Permalink
fix: excludes comma from ref
Browse files Browse the repository at this point in the history
  • Loading branch information
ccfish86 committed May 30, 2024
1 parent e0b8427 commit 381cab9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openapi/generator.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package openapi

import (
"encoding/json"
"errors"
"fmt"
"net/http"
"os"
"reflect"
"regexp"
"sort"
Expand All @@ -26,7 +28,7 @@ const (
var (
paramsInPathRe = regexp.MustCompile(`\{(.*?)\}`)
ginPathParamRe = regexp.MustCompile(`\/:([^\/]*)`)
refRe = regexp.MustCompile("[\\[\\]\\.\\*]|(\\w+(-\\w+)?/)") // Replace all words that do not conform [RFC3986-compliant]
refRe = regexp.MustCompile(`[\[\]\.\*,]|(\w+(-\w+)?/)`) // Replace all words that do not conform [RFC3986-compliant]
)

// mediaTags maps media types to well-known
Expand Down Expand Up @@ -653,6 +655,9 @@ func (g *Generator) addStructFieldToOperation(op *Operation, t reflect.Type, idx

// Check if a field with the same name already exists.
if _, ok := schema.Properties[fname]; ok {
jsss, _ := json.Marshal(schema.Properties)
_ = os.WriteFile(fmt.Sprintf("d:\\test_%s.txt", fname), jsss, 0644)

g.error(&FieldError{
Message: "duplicate request body parameter",
Name: fname,
Expand Down

0 comments on commit 381cab9

Please sign in to comment.