Issue with Reusable Components in OpenAI Custom Model - Unable to Reference Other Components

Hello OpenAI Community,

I’m encountering a challenge with reusable components in my custom GPT related to referencing other components within the OpenAPI schema. It appears that components are unable to reference each other correctly.

Problem Description:

In my OpenAPI 3.1.0 schema, I have defined several reusable components. However, when I attempt to reference one component from another within the schema, the reference doesn’t seem to work as expected.

Schema Overview:

Here’s a simplified overview of my schema structure:

jsonCopy code

"components": {
  "schemas": {
    "Element": {
        "type": "object",
        "discriminator": {
          "propertyName": "componentType"
        },
        "properties": {
          "alignment": {
            "type": "string",
            "description": "The alignment of the item",
            "enum": [
              "left",
              "center",
              "right"
            ]
          }
        },
        "required": []
      },
      "Text": {
        "description": "A representation of a text Element",
        "allOf": [
          {
            "$ref": "#/components/schemas/Element"
          },
          {
            "type": "object",
            "properties": {
              "text": {
                "type": "string"
              },
              ...
            },
            "required": [
              "text"
            ]
          }
        ]
      },
      "Image": {
        "description": "A representation of an image Element",
        "allOf": [
          {
            "$ref": "#/components/schemas/Element"
          },
          {
            "type": "object",
            "properties": {
              "base64Image": {
                "type": "string",
                "contentMediaType": "image/png",
                "contentEncoding": "base64"
              }
            },
            "required": [
              "base65Image"
            ]
          }
        ]
      },
    "Section": {
      "type": "object",
      "properties": {
        "elements": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/Element"
          }
        }
      }
    }
    // Other schemas
  }
}

Issue in Action:

When the custom GPT sends a request using this schema, the elements within a Section are not correctly utilizing the Element schema. Instead, it seems to bypass or misinterpret the referenced schema.

Example Request Sent by Custom GPT:

jsonCopy code

{
  "sections": [
    {
      "elements": [
        // Elements here do not follow the 'Element' schema structure
      ]
    }
  ]
}

The wrong schema is related with the error i get in the schema-editor of the custom GPT:

In context=('components', 'schemas', 'Text', 'allOf', '0'), reference to unknown component Element; using empty schema
In context=('components', 'schemas', 'Image', 'allOf', '0'), reference to unknown component Element; using empty schema

Expected Behavior:

I expected the elements within each Section to adhere strictly to the Element schema as defined in the components.

Questions:

  1. Is there a known limitation or issue with component referencing in custom GPT models?
  2. Are there any workarounds or best practices to ensure components can reference each other effectively?

I already tried out various options like using yaml instead of json. Not using the “allOf” attribute. Nothing seems to work when referencing reusable components from within a reusable component in the schema section.

I appreciate any insights or solutions the community might have regarding this issue. Thank you!

3 Likes