Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-1165

OpenAPI generate multiple resources/subresources in POST request

XMLWordPrintable

      For provided model, OpenAPI generate incorrect JSON example:

      curl -X 'POST' \
        'http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=36001-sim-device/yang-ext:mount/toaster-example:lst=data/cont1/cont11' \
        -H 'accept: */*' \
        -H 'Content-Type: application/json' \
        -d '{
        "lf111": 0,
        "lf112": "Some lf112"
      }' 

      Response:

      {
        "errors": {
          "error": [
            {
              "error-tag": "operation-failed",
              "error-info": "Normalized Node result was already set.",
              "error-message": "Error parsing json input: Failed to create new parse result data. Are you creating multiple resources/subresources in POST request?",
              "error-type": "application"
            }
          ]
        }
      } 

       
      Operation object:

        "post": {
          "deprecated": false,
          "tags": [
            "36001-sim-device toaster-example"
          ],
          "parameters": [
            {
              "name": "lf1",
              "in": "path",
              "required": true,
              "schema": {
                "type": "string"
              }
            }
          ],
          "requestBody": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "cont11": {
                      "$ref": "#/components/schemas/toaster-example_lst_cont1_cont11"
                    }
                  }
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/toaster-example_lst_cont1_cont11"
                }
              }
            },
            "description": "cont11"
          }
        }

      Schema object:

        "toaster-example_lst_cont1_cont11": {
          "properties": {
            "lf111": {
              "description": "",
              "type": "integer",
              "example": 0,
              "format": "int64",
              "uniqueItems": false
            },
            "lf112": {
              "description": "",
              "type": "string",
              "example": "Some lf112",
              "uniqueItems": false
            }
          },
          "xml": {
            "name": "cont11",
            "namespace": "http://netconfcentral.org/ns/toaster/example",
            "attribute": false,
            "wrapped": false
          },
          "description": "",
          "title": "toaster-example_lst_cont1_cont11",
          "type": "object"
        }  

            SamoSchneider Samuel Schneider
            PeterSuna Peter Suna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: