Invalid Swagger specification file. Info section doesn't exists. #1526

Closed
opened 2025-12-29 16:32:41 +01:00 by adam · 4 comments
Owner

Originally created by @rhys-intelliflo on GitHub (Feb 1, 2018).

Issue type

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

I have installed PSSwagger and and ran the following function only for it to state
"Invalid Swagger specification file. Info section doesn't exists."

New-PSSwaggerModule -SpecificationUri https://FQDN/api/docs/%3Fformat=openapi -Name PSNetbox -Path . -Verbose

Looking through the PowerShell source code it's this line that throws the error saying that it cannot find the "info" section.

Steps to reproduce

Install-Module -Name PSSwagger -Scope CurrentUser
Import-Module PSSwagger
New-PSSwaggerModule -SpecificationUri https://FQDN/api/docs/%3Fformat=openapi -Name PSNetbox -Path . -Verbose

Environment

  • Python version: 3
  • NetBox version: 2.2.8

Any ideas / thoughts?

Originally created by @rhys-intelliflo on GitHub (Feb 1, 2018). ### Issue type [ ] Feature request <!-- An enhancement of existing functionality --> [X] Bug report <!-- Unexpected or erroneous behavior --> [ ] Documentation <!-- A modification to the documentation --> I have installed PSSwagger and and ran the following function only for it to state "Invalid Swagger specification file. Info section doesn't exists." ``` New-PSSwaggerModule -SpecificationUri https://FQDN/api/docs/%3Fformat=openapi -Name PSNetbox -Path . -Verbose ``` Looking through the PowerShell source code it's [this line that throws the error](https://github.com/PowerShell/PSSwagger/blob/developer/PSSwagger/SwaggerUtils.psm1#L130) saying that it cannot find the "info" section. Steps to reproduce ``` Install-Module -Name PSSwagger -Scope CurrentUser Import-Module PSSwagger New-PSSwaggerModule -SpecificationUri https://FQDN/api/docs/%3Fformat=openapi -Name PSNetbox -Path . -Verbose ``` ### Environment * Python version: 3 * NetBox version: 2.2.8 Any ideas / thoughts?
adam closed this issue 2025-12-29 16:32:41 +01:00
Author
Owner

@aaroneg commented on GitHub (Feb 5, 2018):

Also seeing weirdness with PSSwagger. v2.2.9.

@aaroneg commented on GitHub (Feb 5, 2018): Also seeing weirdness with PSSwagger. v2.2.9.
Author
Owner

@davcamer commented on GitHub (Feb 28, 2018):

I am working on generating a golang client from swagger. As part of that, I have a more complete swagger.json for Netbox v2.3 committed over here:
https://github.com/davcamer/go-netbox/blob/swagger-generated/swagger.json

I tried generating a client using powershell on MacOS and it got fairly far in to generating the operations, although did eventually die with an error about AutoRest being missing. You might have more luck with the swagger file on windows?

Here is the tail of my generation session, using that file:

VERBOSE: Using cmdlet name 'Virtualmachinescreate-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_create'.
VERBOSE: Getting details for Swagger path operation with operationid 'virtualization_virtual-machines_read'.
VERBOSE: Verb 'virtual-machines_read' not an approved verb.
VERBOSE: Using cmdlet name 'Virtualmachinesread-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_read'.
VERBOSE: Getting details for Swagger path operation with operationid 'virtualization_virtual-machines_update'.
VERBOSE: Verb 'virtual-machines_update' not an approved verb.
VERBOSE: Using cmdlet name 'Virtualmachinesupdate-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_update'.
VERBOSE: Getting details for Swagger path operation with operationid 'virtualization_virtual-machines_partial_update'.
VERBOSE: Verb 'virtual-machines_partial_update' not an approved verb.
VERBOSE: Using cmdlet name 'Virtualmachinespartialupdate-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_partial_update'.
VERBOSE: Getting details for Swagger path operation with operationid 'virtualization_virtual-machines_delete'.
VERBOSE: Verb 'virtual-machines_delete' not an approved verb.
VERBOSE: Using cmdlet name 'Virtualmachinesdelete-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_delete'.
VERBOSE: Generating CSharp Code using AutoRest
Unable to find AutoRest in PATH environment. Ensure the PATH is updated.
At /Users/davecameron/.local/share/powershell/Modules/PSSwagger/0.3.0/PSSwagger.psm1:744 char:9
+         throw $LocalizedData.AutoRestNotInPath
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : OperationStopped: (Unable to find ...ATH is updated.:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to find AutoRest in PATH environment. Ensure the PATH is updated.
@davcamer commented on GitHub (Feb 28, 2018): I am working on generating a golang client from swagger. As part of that, I have a more complete swagger.json for Netbox v2.3 committed over here: https://github.com/davcamer/go-netbox/blob/swagger-generated/swagger.json I tried generating a client using powershell on MacOS and it got fairly far in to generating the operations, although did eventually die with an error about AutoRest being missing. You might have more luck with the swagger file on windows? Here is the tail of my generation session, using that file: ``` VERBOSE: Using cmdlet name 'Virtualmachinescreate-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_create'. VERBOSE: Getting details for Swagger path operation with operationid 'virtualization_virtual-machines_read'. VERBOSE: Verb 'virtual-machines_read' not an approved verb. VERBOSE: Using cmdlet name 'Virtualmachinesread-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_read'. VERBOSE: Getting details for Swagger path operation with operationid 'virtualization_virtual-machines_update'. VERBOSE: Verb 'virtual-machines_update' not an approved verb. VERBOSE: Using cmdlet name 'Virtualmachinesupdate-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_update'. VERBOSE: Getting details for Swagger path operation with operationid 'virtualization_virtual-machines_partial_update'. VERBOSE: Verb 'virtual-machines_partial_update' not an approved verb. VERBOSE: Using cmdlet name 'Virtualmachinespartialupdate-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_partial_update'. VERBOSE: Getting details for Swagger path operation with operationid 'virtualization_virtual-machines_delete'. VERBOSE: Verb 'virtual-machines_delete' not an approved verb. VERBOSE: Using cmdlet name 'Virtualmachinesdelete-Virtualization' for Swagger path operationid 'virtualization_virtual-machines_delete'. VERBOSE: Generating CSharp Code using AutoRest Unable to find AutoRest in PATH environment. Ensure the PATH is updated. At /Users/davecameron/.local/share/powershell/Modules/PSSwagger/0.3.0/PSSwagger.psm1:744 char:9 + throw $LocalizedData.AutoRestNotInPath + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Unable to find ...ATH is updated.:String) [], RuntimeException + FullyQualifiedErrorId : Unable to find AutoRest in PATH environment. Ensure the PATH is updated. ```
Author
Owner

@jeremystretch commented on GitHub (Mar 22, 2018):

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

@jeremystretch commented on GitHub (Mar 22, 2018): #1930 has been merged into `develop`. Can we confirm whether this issue has been resolved?
Author
Owner

@bbock commented on GitHub (Apr 18, 2018):

I can confirm that with netbox 2.3.2, the swagger file contains a valid info section.

IMO this bug is resolved.

@bbock commented on GitHub (Apr 18, 2018): I can confirm that with netbox 2.3.2, the swagger file contains a valid info section. IMO this bug is resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1526