Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger API Spec indicate custom_fields as String instead of Object #1853

Closed
dgarros opened this issue Feb 1, 2018 · 2 comments
Closed

Swagger API Spec indicate custom_fields as String instead of Object #1853

dgarros opened this issue Feb 1, 2018 · 2 comments

Comments

@dgarros
Copy link
Contributor

dgarros commented Feb 1, 2018

Issue type

[ ] Feature request
[X ] Bug report
[ ] Documentation

Environment

  • Python version: 3.6
  • NetBox version: 2.2.8

Description

I noticed that for all PUT, POST and PATCH API endpoints that support Custom_fields, the parameter custom_fields in the body is defined as a string instead of an object (AKA dict)

See below an example for POST /api/circuits/circuits/ captured from /api/docs/?format=openapi

    "/api/circuits/circuits/": {
      "post": {
        "tags": [
          "circuits"
        ],
        "consumes": [
          "application/json"
        ],
        "responses": {
          "201": {
            "description": ""
          }
        },
        "parameters": [
          {
            "schema": {
              "required": [
                "cid",
                "provider",
                "type"
              ],
              "type": "object",
              "properties": {
                "description": {
                  "type": "string",
                  "description": ""
                },
                "commit_rate": {
                  "type": "integer",
                  "description": ""
                },
                "cid": {
                  "type": "string",
                  "description": ""
                },
                "install_date": {
                  "type": "string",
                  "description": ""
                },
                "comments": {
                  "type": "string",
                  "description": ""
                },
                "custom_fields": {
                  "type": "string",   <<<<<<<<<<<<<
                  "description": ""
                },
                "provider": {
                  "type": "string",
                  "description": ""
                },
                "type": {
                  "type": "string",
                  "description": ""
                },
                "tenant": {
                  "type": "string",
                  "description": ""
                }
              }
            },
            "name": "data",
            "in": "body"
          }
        ],
        "operationId": "circuits_circuits_create"
      }
    },

Here is the full list of path that have the issue as far as I can tell

/api/circuits/circuits/ (POST): 
/api/circuits/circuits/{id}/ (PUT): 
/api/circuits/circuits/{id}/ (PATCH): 
/api/circuits/providers/ (POST): 
/api/circuits/providers/{id}/ (PUT): 
/api/circuits/providers/{id}/ (PATCH): 
/api/dcim/device-types/ (POST): 
/api/dcim/device-types/{id}/ (PUT): 
/api/dcim/device-types/{id}/ (PATCH): 
/api/dcim/devices/ (POST): 
/api/dcim/devices/{id}/ (PUT): 
/api/dcim/devices/{id}/ (PATCH): 
/api/dcim/racks/ (POST): 
/api/dcim/racks/{id}/ (PUT): 
/api/dcim/racks/{id}/ (PATCH): 
/api/dcim/sites/ (POST): 
/api/dcim/sites/{id}/ (PUT): 
/api/dcim/sites/{id}/ (PATCH): 
/api/ipam/aggregates/ (POST): 
/api/ipam/aggregates/{id}/ (PUT): 
/api/ipam/aggregates/{id}/ (PATCH): 
/api/ipam/ip-addresses/ (POST): 
/api/ipam/ip-addresses/{id}/ (PUT): 
/api/ipam/ip-addresses/{id}/ (PATCH): 
/api/ipam/prefixes/ (POST): 
/api/ipam/prefixes/{id}/ (PUT): 
/api/ipam/prefixes/{id}/ (PATCH): 
/api/ipam/prefixes/{id}/available-ips/ (POST): 
/api/ipam/vlans/ (POST): 
/api/ipam/vlans/{id}/ (PUT): 
/api/ipam/vlans/{id}/ (PATCH): 
/api/ipam/vrfs/ (POST): 
/api/ipam/vrfs/{id}/ (PUT): 
/api/ipam/vrfs/{id}/ (PATCH): 
/api/tenancy/tenants/ (POST): 
/api/tenancy/tenants/{id}/ (PUT): 
/api/tenancy/tenants/{id}/ (PATCH): 
/api/virtualization/clusters/ (POST): 
/api/virtualization/clusters/{id}/ (PUT): 
/api/virtualization/clusters/{id}/ (PATCH): 
/api/virtualization/virtual-machines/ (POST): 
/api/virtualization/virtual-machines/{id}/ (PUT): 
/api/virtualization/virtual-machines/{id}/ (PATCH): 
@jeremystretch jeremystretch added status: under review Further discussion is needed to determine this issue's scope and/or implementation and removed help wanted labels Mar 22, 2018
@jeremystretch
Copy link
Member

#1930 has been merged into develop. Can we confirm whether this issue has been resolved?

@bbock
Copy link
Contributor

bbock commented Apr 18, 2018

I can confirm that with netbox 2.3.2, the swagger file contains custom_fields as object for the endpoint /api/circuits/circuits/ and not as string as described above.

IMO this bug is resolved.

@jeremystretch jeremystretch removed the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Apr 18, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants