admin管理员组

文章数量:1406943

I know is not the intended use of OpenAPI, but I need to hardcode the XML requests to be sent to some endpoints in my OpenAPI specification to workaround some external service for pen-testing that is not working properly with our last specification.

I have such a thing:

{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "OpenAPI definition",
    "version" : "v0"
  },
  "servers" : [
    {
      "url" : "http://localhost:8083",
      "description" : "Server url"
    }
  ],
  "paths" : {
    "/1/endpoint1" : {
      "post" : {
        "operationId" : "myOperation-1",
        "requestBody" : {
          "content"  {
            "application/xml" : {
              "schema" : {
                "$ref" : "#/components/schemas/MyOperation1RQ"
              }
            }
          }
        }      
      }
    }
  }

...
  "MyOperation1RQ" : {
    "required" : [
      "request"
    ],
    "type" : "object",
    "properties" : {
      "request" : {
        "$ref" : "#/components/schemas/MyOperation1RequestRQ"
      }
    },
    "xml" : {
      "name" : "My_Operation_1_RQ",
      "namespace" : "http://wwwww"
    }
  }
}

I need to prevent from using the $ref (or update below in MyOperation1RQ) so that, instead of the current structure, for MyOperation1RQ is used a predefined / hardcored request that I have prepared.

<My_Operation_1_RQ namespace=\"http://wwwww\"><Request>...</Request></My_Operation_1_RQ>

I have tried this:

  "paths" : {
    "/1/endpoint1" : {
      "post" : {
        "operationId" : "myOperation-1",
        "requestBody" : {
          "content"  {
            "application/xml" : {
              "schema" : {
                "example" : "<My_Operation_1_RQ namespace=\"http://wwwww\"><Request>...</Request></My_Operation_1_RQ>"
              }
            }
          }
        }      
      }
    }
  }

本文标签: OpenAPI harcoded request for endpointStack Overflow