utoipa icon indicating copy to clipboard operation
utoipa copied to clipboard

description missing when mixing inline + user-defined type

Open JMLX42 opened this issue 8 months ago • 1 comments

How to reproduce

utoipa version 4.0.0

    #[schema(as = BufferResourceIdentifierObject)]
    pub struct BufferResourceIdentifierObject {
        #[serde(rename = "type")]
        #[schema(default = "buffers")]
        type_name: String,
        id: uuid::Uuid,
    }

    pub struct BufferResourceRelationshipToOne {
        #[schema(inline)]
        pub data: BufferResourceIdentifierObject,
    }

   #[serde(rename_all = "camelCase")]
    pub struct BufferViewResourceSparseRelationships {
        #[serde(default, skip_serializing_if = "Option::is_none")]
        #[schema(inline)]
        /// The index of the buffer.
        pub buffer: Option<crate::buffer::BufferResourceRelationshipToOne>,
    }

Actual Result

For some reason, the description field is missing.

{
  "relationships": {
    "type": "object",
    "properties": {
      "buffer": {
        "allOf": [
          {
            "type": "object",
            "required": [
              "data"
            ],
            "properties": {
              "data": {
                "type": "object",
                "required": [
                  "type",
                  "id"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "default": "buffers"
                  },
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        ],
        "nullable": true
      }
    }
  }
}

Expected Result

{
  "relationships": {
    "type": "object",
    "properties": {
      "buffer": {
        "allOf": [
          {
            "description": "The index of the buffer.",
            "type": "object",
            "required": [
              "data"
            ],

JMLX42 avatar Nov 09 '23 20:11 JMLX42