-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
protoc-gen-openapiv2: Support map in query parameters #3238
Comments
This is correct in OA3 : openapi: 3.0.1
info:
title: test.proto
version: version not set
servers:
- url: /
tags:
- name: Foo
paths:
/list:
get:
tags:
- Foo
summary: Sends a greeting
operationId: Foo_Bar
parameters:
- name: filter
in: query
schema:
type: object
format: string
responses:
200:
description: A successful response.
content:
application/json:
schema:
$ref: '#/components/schemas/rpxBarResponse'
default:
description: An unexpected error response.
content:
application/json:
schema:
$ref: '#/components/schemas/rpcStatus'
components:
schemas:
protobufAny:
type: object
properties:
'@type':
type: string
additionalProperties:
type: object
rpcStatus:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
$ref: '#/components/schemas/protobufAny'
rpxBarResponse:
type: object
|
Hi, thanks for your issue! Note firstly that we do not support OpenAPIv3, only OpenAPIv2. It might still support specifying objects as strings in query parameters, but I'm a little curious exactly what format it uses. Is it a JSON literal? It is a bit gross to pass information like that, but theoretically you could support this today by using a Nevertheless, this does seem like a fair feature request. The logic for doing this translation is here (I think): grpc-gateway/protoc-gen-openapiv2/internal/genopenapi/template.go Lines 256 to 258 in b45f184
Note that the gRPC-Gateway query parameter parser itself happily handles maps, but the format is probably not the one that OpenAPI3 uses: grpc-gateway/runtime/query_test.go Lines 59 to 77 in b45f184
Are you interested in contributing this feature? |
Yes, I am. Swagger 2.0 does not support object as query parameter :(
I think we need switch to OpenAPI 3.1 |
I have two question
|
The format is as can be seen in the tests: As a side note please don't @ me directly like this, it is rude. |
First of all I am very sorry for direct @you and I promise this will never happen again in any open source project. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Please feel free to work on adding generated example if none is provided, to make it easier to use. |
the following result
proto
in swagger have problem with proto map in GET method as request.https://swagger.io/docs/specification/data-models/data-types/#object
Maps should be represented as objects in request.
The text was updated successfully, but these errors were encountered: