Skip to content

Commit 9baf901

Browse files
committed
feat: add support for path parameters in OpenAPI request generation
1 parent 48e1c32 commit 9baf901

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

pkg/spec/request.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ func addRequestInfoForParamType(gen *openapi3gen.Generator, schemas openapi3.Sch
112112
WithSchema(getSchemaForType(field.Type)),
113113
},
114114
)
115+
} else if field.Tag.Get("path") != "" {
116+
op.Parameters = append(
117+
op.Parameters,
118+
&openapi3.ParameterRef{
119+
Value: openapi3.NewPathParameter(field.Tag.Get("path")).
120+
WithRequired(field.Type.Kind() != reflect.Ptr).
121+
WithSchema(getSchemaForType(field.Type)),
122+
},
123+
)
115124
}
116125
}
117126
}

0 commit comments

Comments
 (0)