bitcat365 / oasisscan-backend

oasisscan.com backend
3 stars 4 forks source link

ValidatorInfo spec vs API response #9

Open buberdds opened 7 hours ago

buberdds commented 7 hours ago

Hey again,

in V2, API endpoint validator/list returns a list of ValidatorInfo. There are props that are defined as an array, but API returns null. This may cause unexpected behaviors in clients if code is auto generated based on spec.

API: https://api.oasisscan.com/v2/mainnet/validator/list?orderBy=escrow&sort=desc Spec: https://github.com/bitcat365/oasisscan-backend/blob/master/api/api.json#L3512 Problematic ValidatorInfo props:

        "rates": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Rate"
          }
        },
        "bounds": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Bound"
          }
        "runtimes": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/ValidatorRuntime"
          }
        },

1) Can we expect these props will have always values? (maybe it's indexing issue and data is not available yet?) 2) Can these array props default to an empty array? 3) Can spec be in openapi v3 to get nullable support?

romever commented 3 hours ago

I would consider returning an empty array instead of null for array type properties.