Skip to content

Commit

Permalink
add context to error message for comment tags
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzielenski committed Apr 29, 2024
1 parent 20ee2c5 commit ef73428
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/generators/markers.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type commentTags struct {

// Nested commentTags for extending the schemas of subfields at point-of-use
// when you cant annotate them directly. Cannot be used to add properties
// or remove validations on the overriden schema.
// or remove validations on the overridden schema.
Items *commentTags `json:"items,omitempty"`
Properties map[string]*commentTags `json:"properties,omitempty"`
AdditionalProperties *commentTags `json:"additionalProperties,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/generators/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (g openAPITypeWriter) generate(t *types.Type) error {
case types.Struct:
validationSchema, err := ParseCommentTags(t, t.CommentLines, markerPrefix)
if err != nil {
return err
return fmt.Errorf("failed parsing comment tags for %v: %w", t.String(), err)
}

hasV2Definition := hasOpenAPIDefinitionMethod(t)
Expand Down

0 comments on commit ef73428

Please sign in to comment.