Discussions

Ask a Question
Back to All

OneOf not rendering on readme, but functions on swagger

Hi,

I have a json that is similar to the below

{
  "responses": {
    "200": {
      "description": "success for v=(cat, dog)",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "title": "cat",
                "type": "object",
                "properties": {
                  "results": {
                    "type": "array",
                    "properties": {
                      "traversable_again": {
                        "type": "boolean"
                      }
                    },
                    "items": {
                      "$ref": "#/components/schemas/cat"
                    }
                  },
                  "context": {
                    "$ref": "#/components/schemas/Context"
                  }
                }
              },
              {
                "title": "Dog",
                "type": "object",
                "properties": {
                  "results": {
                    "type": "array",
                    "properties": {
                      "traversable_again": {
                        "type": "boolean"
                      }
                    },
                    "items": {
                      "$ref": "#/components/schemas/Dog"
                    }
                  },
                  "context": {
                    "$ref": "#/components/schemas/Context"
                  }
                }
              }
            ]
          }
        }
      }
    }
  }
}

This renders properly in the swagger editor at https://editor-next.swagger.io/, but does not render properly on ReadMe. Is there something about this Json that is preventing it from rendering properly?

I originally tried doing it without a title, but added a title per https://docs.readme.com/main/discuss/60abdd017806a8003d86330c (but it is still not properly rendering)

It seems to me to be the same as the example here

"/anything/polymorphism": {
      "get": {
        "summary": "Polymorphism",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "string",
                      "title": "first object"
                    },
                    {
                      "$ref": "#/components/schemas/Pet"
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              }
            }
          }
        }