OpenAPI 3 issues #7751

Closed
opened 2025-12-29 20:27:48 +01:00 by adam · 1 comment
Owner

Originally created by @arthanson on GitHub (Mar 13, 2023).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.5.0

Python version

3.8

Steps to Reproduce

Generate OpenAPI Schema

Expected Behavior

The OpenAPI schema should match the code / OpenAPI 2 schema.

Observed Behavior

1. Errors in Validator*
I tried to generate a client with https://openapi-generator.tech for go. I got the following errors:

Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 2, Warning count: 0
Errors: 
        -attribute components.schemas.PatchedPowerFeed.default is not of type `string`
        -attribute components.schemas.PowerFeed.default is not of type `string`

This seems fixed

Manually inspecting the generated schema, I found the following regressions:

2. Bulk operations should specify a list

  • The bulk operations for patch, post, put do not specify a list of objects as input or output. According to spec these operations only work on single objects. Still applies

3. Bulk delete should specify input

  • Bulk delete does not specify any input. Still applies

4. Wrong type on fields

  • Some fields use the wrong type, e.g
    • config_context of VirtualMachineWithConfigContext. Should be type object is type string. (local_context_data on the other hand looks good) Fixed
    • custom_fields of VirtualMachineWithConfigContext. Should be type object is type string. Fixed
    • assigned_object of Ipaddress. Same as above. Fixed

5. Readonly fields as required

  • The models specify all(?) readonly fields as required. e.g. Prefix which list as required: [ "_depth", "children", "created" "display", "family", "id", "last_updated", "prefix", "url"] Still applies

6. Check normal vs writeable models

  • Not sure if this is a problem. The Distinction between normal and writable models is gone. Does this mean POST accepts a virtualmachine with a NestedSite? Still applies

7. Description Off

  • The descriptions are off. Some descriptions are from the ValidatedModelSerializer, some from NetboxModelSerializer. Still applies

Originally posted by @amhn in https://github.com/netbox-community/netbox/discussions/11808#discussioncomment-5208802

Originally created by @arthanson on GitHub (Mar 13, 2023). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.5.0 ### Python version 3.8 ### Steps to Reproduce Generate OpenAPI Schema ### Expected Behavior The OpenAPI schema should match the code / OpenAPI 2 schema. ### Observed Behavior **1. Errors in Validator*** I tried to generate a client with https://openapi-generator.tech for go. I got the following errors: ``` Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI). | Error count: 2, Warning count: 0 Errors: -attribute components.schemas.PatchedPowerFeed.default is not of type `string` -attribute components.schemas.PowerFeed.default is not of type `string` ``` **This seems fixed** Manually inspecting the generated schema, I found the following regressions: **2. Bulk operations should specify a list** - The bulk operations for patch, post, put do not specify a list of objects as input or output. According to spec these operations only work on single objects. **Still applies** **3. Bulk delete should specify input** - Bulk delete does not specify any input. **Still applies** **4. Wrong type on fields** - Some fields use the wrong type, e.g - config_context of VirtualMachineWithConfigContext. Should be type object is type string. (local_context_data on the other hand looks good) **Fixed** - custom_fields of VirtualMachineWithConfigContext. Should be type object is type string. **Fixed** - assigned_object of Ipaddress. Same as above. **Fixed** **5. Readonly fields as required** - The models specify all(?) readonly fields as required. e.g. Prefix which list as required: [ "_depth", "children", "created" "display", "family", "id", "last_updated", "prefix", "url"] **Still applies** **6. Check normal vs writeable models** - Not sure if this is a problem. The Distinction between normal and writable models is gone. Does this mean POST accepts a virtualmachine with a NestedSite? **Still applies** **7. Description Off** - The descriptions are off. Some descriptions are from the ValidatedModelSerializer, some from NetboxModelSerializer. **Still applies** _Originally posted by @amhn in https://github.com/netbox-community/netbox/discussions/11808#discussioncomment-5208802_
adam added the type: bugstatus: accepted labels 2025-12-29 20:27:48 +01:00
adam closed this issue 2025-12-29 20:27:48 +01:00
Author
Owner

@arthanson commented on GitHub (Mar 20, 2023):

addressed in #11626

@arthanson commented on GitHub (Mar 20, 2023): addressed in #11626
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7751