open-match icon indicating copy to clipboard operation
open-match copied to clipboard

support for rest mmf function CALL in openapi

Open dzmitry-lahoda opened this issue 3 years ago • 3 comments

#Steps:

implement match function callback and return single match

{
  "result": {
    "proposal": {
      "match_id": "string",
      "match_profile": "string",
      "match_function": "string",
      "tickets": [
        {
          "id": "string",
          "assignment": {
            "connection": "string",
            "extensions": {
              "additionalProp1": {
                "type_url": "string",
                "value": "string"
              },
              "additionalProp2": {
                "type_url": "string",
                "value": "string"
              },
              "additionalProp3": {
                "type_url": "string",
                "value": "string"
              }
            }
          },
          "search_fields": {
            "double_args": {
              "additionalProp1": 0,
              "additionalProp2": 0,
              "additionalProp3": 0
            },
            "string_args": {
              "additionalProp1": "string",
              "additionalProp2": "string",
              "additionalProp3": "string"
            },
            "tags": [
              "string"
            ]
          },
          "extensions": {
            "additionalProp1": {
              "type_url": "string",
              "value": "string"
            },
            "additionalProp2": {
              "type_url": "string",
              "value": "string"
            },
            "additionalProp3": {
              "type_url": "string",
              "value": "string"
            }
          },
          "create_time": "2021-07-25T11:30:35.908Z"
        }
      ],
      "extensions": {
        "additionalProp1": {
          "type_url": "string",
          "value": "string"
        },
        "additionalProp2": {
          "type_url": "string",
          "value": "string"
        },
        "additionalProp3": {
          "type_url": "string",
          "value": "string"
        }
      },
      "backfill": {
        "id": "string",
        "search_fields": {
          "double_args": {
            "additionalProp1": 0,
            "additionalProp2": 0,
            "additionalProp3": 0
          },
          "string_args": {
            "additionalProp1": "string",
            "additionalProp2": "string",
            "additionalProp3": "string"
          },
          "tags": [
            "string"
          ]
        },
        "extensions": {
          "additionalProp1": {
            "type_url": "string",
            "value": "string"
          },
          "additionalProp2": {
            "type_url": "string",
            "value": "string"
          },
          "additionalProp3": {
            "type_url": "string",
            "value": "string"
          }
        },
        "create_time": "2021-07-25T11:30:35.908Z",
        "generation": "string"
      },
      "allocate_gameserver": true
    }
  },
  "error": {
    "code": 0,
    "message": "string",
    "details": [
      {
        "type_url": "string",
        "value": "string"
      }
    ]
  }
}

get callback from backend service

{"profile":{"name":"any","pools":[{"name":"any"}]}}
{
  "content-length": "51",
  "accept-encoding": "gzip",
  "user-agent": "Go-http-client/2.0"
}

Expected

  • information about current page of batch, synchronizer cycle, anything to help stream matches

Actual:

  • I cannot create REST callback as per OpenAPI spec

Considered

  • use GRPC only
  • may be OpenAPI is wrong telling me One element? May be really I can return array?
  • callbased API to push data upon request

dzmitry-lahoda avatar Jul 25 '21 11:07 dzmitry-lahoda

https://github.com/googleforgames/open-match/blob/6f46731b156f5ada463b309e0a35774b11255323/internal/app/backend/backend_service.go#L294

It seems on this call need to put non open api compatible broken jsons into response. HTTP2 stream of some format. I suppose serialize each match body into stream. And serialize immediately next. Close stream in the end.

so will have

{}
{}

broken json, but seems it will work.

dzmitry-lahoda avatar Jul 29 '21 06:07 dzmitry-lahoda

So, I used Go based MMF hosted in Agones. But when director calls Backend via REST to GRPC Go, Backend rest returns openmatchFetchMatchesResponse = which contains only one match. So it seems OpenAPI broken on call side either and need manually parse response body and from request.

dzmitry-lahoda avatar Aug 02 '21 06:08 dzmitry-lahoda

"extensions\":{\"open-slots\":{\"@type\":\"type.googleapis.com/google.protobuf.Int32Value\",\"value\":7}}

Response neither contains type_url nor byte array... So open API is broken regarding real responses

image

dzmitry-lahoda avatar Aug 02 '21 08:08 dzmitry-lahoda

Closing due to functionality seems possible as Open Match stands. OpenAPI seems to the issue at this point. Reopen in this is not the case.

syntxerror avatar Sep 28 '22 15:09 syntxerror