open-rpc / playground

A place to play around with OpenRPC. https://playground.open-rpc.org
https://playground.open-rpc.org
Apache License 2.0
40 stars 25 forks source link

Fields with multiple types are displayed incorrectly #597

Open dleflohic opened 2 years ago

dleflohic commented 2 years ago

Describe the bug The type of fields that have a schema like below appears as stringnull in https://playground.open-rpc.org/:

"type": [
  "string",
  "null"
]

Note: the schema is following the current latest specification of Json schema: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-type

To Reproduce Copy/paste the following json:

{
  "openrpc": "1.2.1",
  "info": {
    "version": "0.1.0-SNAPSHOT",
    "title": "Example"
  },
  "methods": [
    {
      "name": "my_endpoint",
      "params": [],
      "result": {
        "name": "response",
        "schema": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  ]
}

Expected behavior Information about the type are displayed in a prettier and correct way, without concatenated the types.