define default values in openapi spec
See original GitHub issueNetBox version
v2.11.1
Feature type
Data model extension
Proposed functionality
It would be nice if the default values for each property (if any) are also defined in the Netbox OpenAPI spec. They are, so far I can see, not defined for each and every object.
For example:
"status": {
"title": "Status",
"type": "string",
"enum": [
"planned",
"provisioning",
"active",
"offline",
"deprovisioning",
"decommissioned"
]
},
could be defined as
"status": {
"title": "Status",
"type": "string",
"default": "active",
"enum": [
"planned",
"provisioning",
"active",
"offline",
"deprovisioning",
"decommissioned"
]
},
Since active
value for status is the default returned by the API.
Use case
This helps us updating various netbox resources using OpenAPI libs.
Database changes
No response
External dependencies
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Describing Parameters - Swagger
Use the default keyword in the parameter schema to specify the default value for an optional parameter. The default value is the one...
Read more >Can a swagger object passed as a parameter have default ...
default - The default value represents what would be assumed by the consumer of the input as the value of the schema if...
Read more >OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
The OpenAPI Specification (OAS) defines a standard, ... the default value would be a Server Object with a url value of / ....
Read more >OpenAPI Specification
The Swagger specification defines a set of files required to describe such an ... Otherwise, the property MAY be included and its default...
Read more >Using OpenAPI and Swagger UI - Quarkus
An OpenAPI document that conforms to the OpenAPI Specification is itself a valid JSON object, ... Function to set default values to each...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jeremystretch nvm, I found an example:
https://github.com/netbox-community/netbox/blob/28ca815c8855b06e4250e7610fadc7c968c91dcb/netbox/dcim/api/serializers.py#L902-L920
I will look into it this week then
This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.