rawlinp opened a new issue #2494: Multiple Go API endpoints don't return 
"joined" fields on PUT/POST
URL: https://github.com/apache/trafficcontrol/issues/2494
 
 
   This is a regression from the Perl API, where keys like 
`parentCachegroupName` are returned with the name of the cachegroup rather than 
`null`. This requires following up `INSERT` or `UPDATE` SQL statements with a 
`SELECT` that returns the proper fields. This is essentially what the Perl API 
did through the DBIx ORM for these endpoints, but currently these APIs don't 
follow up with a `SELECT` to return the same data as the Perl API and return a 
`null` value in the response:
   
   - POST, PUT /api/1.1/cachegroups
     - parentCachegroupName, secondaryParentCachegroupName, typeName
   - POST, PUT /api/1.1/asns
     - cachegroup
   - POST, PUT /api/1.3/deliveryservices
     - cdnName, profileName, profileDescription
   - POST, PUT /api/1.1/regions
     - divisionName
   - POST, PUT /api/1.1/phys_locations
     - region
   - POST, PUT /api/1.1/servers
     - cachegroup, cdnName, physLocation, profile, profileDesc, status, type
   - POST, PUT /api/1.1/tenants
     - parentName
   
   Example PUT /cachegroups/{id} response from traffic_ops_golang:
   ```
   {
       "alerts": [
           {
               "level": "success",
               "text": "cachegroup was updated."
           }
       ],
       "response": {
           "fallbackToClosest": null,
           "id": 531,
           "lastUpdated": "2018-07-02 17:07:59+00",
           "latitude": 39.739167,
           "longitude": -104.984722,
           "name": "rawl-cg",
           "parentCachegroupId": 3,
           "parentCachegroupName": null,
           "secondaryParentCachegroupId": null,
           "secondaryParentCachegroupName": null,
           "shortName": "rawl-cg",
           "typeId": 6,
           "typeName": null
       }
   }
   ```
   Example PUT /cachegroups/{id} response from Perl TO with the same request 
payload:
   ```
   {
       "alerts": [
           {
               "level": "success",
               "text": "Cachegroup update was successful."
           }
       ],
       "response": {
           "fallbackToClosest": 1,
           "id": 532,
           "lastUpdated": "2018-07-02 21:42:40.062963+00",
           "latitude": 39.739167,
           "longitude": -104.984722,
           "name": "rawl-cg",
           "parentCachegroupId": 3,
           "parentCachegroupName": "mid-west",
           "secondaryParentCachegroupId": null,
           "secondaryParentCachegroupName": null,
           "shortName": "rawl-cg",
           "typeId": 6,
           "typeName": "EDGE_LOC"
       }
   }
   ```
   Notice how the Perl API returns all the `fooName` fields whereas the Go API 
returns `null`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to