open-match
open-match copied to clipboard
openapi spec for must return nullable typed for 200 in /v1/queryservice/tickets:query
Steps:
- https://storage.googleapis.com/open-match-chart/api/v0.0.0-dev/query.swagger.json
- Generate client from it by some tool which adheres to OpenApi spec
Expected:
- When there are no tickets, all is ok
Actual:
- Generated client throws exception about null return
Fix:
- make types nullables if they are such ("x-nullable")
Next fix works with client generator(
"/v1/queryservice/tickets:query": {
"post": {
"summary": "QueryTickets gets a list of Tickets that match all Filters of the input Pool.\n - If the Pool contains no Filters, QueryTickets will return all Tickets in the state storage.\nQueryTickets pages the Tickets by `queryPageSize` and stream back responses.\n - queryPageSize is default to 1000 if not set, and has a minimum of 10 and maximum of 10000.",
"operationId": "QueryService_QueryTickets",
"responses": {
"200": {
"x-nullable": true,
"description": "A successful response.(streaming responses)",
"schema": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/openmatchQueryTicketsResponse"
},
"error": {
Notes
I think other methods should be patches either
Hi @dzmitry-lahoda - thanks for the issue. Can you expand on what you mean by
I think other methods should be patches either a little bit so we can better understand this part of the issue? Thanks!
I think other methods should be patches either
@joeholley I believe this was saying there way be other methods that throw exceptions in the case where having no results is acceptable such as no assignments, no tickets, etc. @dzmitry-lahoda correct me if I am wrong
@dzmitry-lahoda I believe this is fine but may you submit a PR with all of the method which this fix may apply to as well?
is not json generated from proto? I was thinkin it should be done there, just sent patch to check if json are generated or manual. so these are manual and need to be kept in sync?
@dzmitry-lahoda, Would you like to submit PR for this change ? We would like to review it.
Hi @dzmitry-lahoda, swagger.json files are auto generated from this command api/%.swagger.json
inside makefile. Thanks!
We investigated this but didn't find a workable way to generate swagger with the x-nullable attrib from protobufs. If you have a working implementation feel free to submit a PR and we'll be happy to review it.