invalid generated swagger from proto with protoc-gen-openapi
i have proto file with { post: "/some/path/XXX?RqUID={RqUID}&RqTm={RqTm}"; body: "*"; }; so i think that generated swagger have RqUID and RqTm in path query parameters and other in body but
paths:
/some/path/XXX?RqUID={RqTm: // this is invalid
post:
tags:
- XXX
operationId: someOperation
parameters:
- name: RqUID
in: path
required: true
schema:
type: string
- name: RqTm
in: path
required: true
schema:
type: string
if u, err := url.Parse(path); err == nil {
mp := u.Query()
path = u.Path
if mp != nil {
for _, field := range inputMessage.Fields {
fieldName := string(field.Desc.Name())
if _, ok := mp[fieldName]; ok && fieldName != bodyField {
fieldParams := g.buildQueryParamsV3(field)
parameters = append(parameters, fieldParams...)
coveredParameters = append(coveredParameters, fieldName)
}
}
}
}
// Find simple path parameters like {id}
if allMatches := g.pathPattern.FindAllStringSubmatch(path, -1); allMatches != nil {
```
this is my ugly code to fix my issue, do you have better ?
i'm parse path via url.Path and check Query parameters if it not nil i'm check does it contains message field name, if so - generate query parameter in swagger
@vtolstov I'm not sure if the post: value is supposed to contain query parameters. In all of the examples provided by google, I don't see any that specifies query parameters in the path. For example, if you look at:
https://cloud.google.com/apis/design/standard_methods#create
it says:
All remaining request message fields shall map to the URL query parameters.
So I'm not sure if this is a valid case.