quarkus-openapi-generator icon indicating copy to clipboard operation
quarkus-openapi-generator copied to clipboard

Add nested components on response body

Open mcruzdev opened this issue 10 months ago • 0 comments

Actually (the first wiremock implementation), when we are generating wiremock stubs from OpenAPI specification, we are not getting nested components:

"Pet": {
        "required": [
          "name",
          "photoUrls"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 10
          },
          "name": {
            "type": "string",
            "example": "doggie"
          },
          "category": {
            "$ref": "#/components/schemas/Category"
          },
          "photoUrls": {
            "type": "array",
            "xml": {
              "wrapped": true
            },
            "items": {
              "type": "string",
              "xml": {
                "name": "photoUrl"
              }
            }
          },
          "tags": {
            "type": "array",
            "xml": {
              "wrapped": true
            },
            "items": {
              "$ref": "#/components/schemas/Tag"
            }
          },
          "status": {
            "type": "string",
            "description": "pet status in the store",
            "enum": [
              "available",
              "pending",
              "sold"
            ]
          }
        },
        "xml": {
          "name": "pet"
        }
      }

The category property is null:

    {
      "request": {
        "urlPathTemplate": "/pet",
        "method": "POST"
      },
      "response": {
        "status": 200,
        "body": "{\"photoUrls\":null,\"name\":\"doggie\",\"id\":10,\"category\":null,\"tags\":null,\"status\":null}"
      }
    },

We need to add the category correctly.

mcruzdev avatar Apr 17 '24 11:04 mcruzdev