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

OpenApi: POST examples are incorrect

XMLWordPrintable

      Issue A: Currently, ODL OpenApi generates examples for POST requests which contain all configuration children in payload.

      This is not correct for both XML and JSON because we cannot create multiple resources with POST request.

      Issue B: We can try to remove all data but the key from payload and we get working example for JSON:

      POST /rests/data/network-topology:network-topology/topology=topology-id 
      {
        "topology-id": "topology-id"
      } 

      But even this approach does not work for XML, for example:

      POST /rests/data/network-topology:network-topology/topology=topology-id  
      <?xml version="1.0" encoding="UTF-8"?>
      <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
          <topology-id xmlns="urn:TBD:params:xml:ns:yang:network-topology">topology-id</topology-id>
      </topology> 

      Because Swagger UI automatically encloses child into topology element (what's correct behavior for XML payloads).

      Instead we should just POST one child as follows:

      <?xml version="1.0" encoding="UTF-8"?>
      <topology-id xmlns="urn:TBD:params:xml:ns:yang:network-topology">Some topology-id</topology-id>

      Solution: POST payloads should contains only the key (lists with key) or empty body (lists without key or containers). Issue B will be addressed separately.

        1. expected-container-in-container-POST.json
          63 kB
        2. expected-container-POST.json
          40 kB
        3. expected-list-in-list-POST.json
          63 kB
        4. expected-list-POST.json
          27 kB
        5. netconf-1045.postman_collection-1.json
          6 kB
        6. original.json
          27 kB
        7. original2.json
          43 kB
        8. original3.json
          63 kB

            yaroslav.lastivka Yaroslav Lastivka
            ivanhrasko Ivan Hrasko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: