Skip to content

openapi should process an api with more than one server #1154

@RegEM

Description

@RegEM

Connecting to the Stellar Horizon api server, via openapi example 2:

Import-PipeScript {
    function Get-HorizonApi
    {
        [OpenAPI(SchemaURI='https://raw.githubusercontent.com/stellar/stellar-docs/refs/heads/main/openapi/horizon/bundled.yml')]
        param()
    }
}
Get-HorizonApi '/accounts'

Invoke-RestMethod:
Line |
 235 |              $restfulOutput = Invoke-RestMethod @invokeSplat
     |                                                 ~~~~~~~~~~~~
     | Cannot bind parameter 'Uri'. Cannot convert value "https://horizon-testnet.stellar.org https://horizon-futurenet.stellar.org/accounts" to type "System.Uri". Error: "Invalid URI: The hostname could not be parsed."

bundle.yml references two servers.

servers:
  - url: https://horizon-testnet.stellar.org
    description: The Testnet Network
  - url: https://horizon-futurenet.stellar.org
    description: The Futurenet network

...which both end up in the url (line 43) of the script block

$Uri, $outputTypeName = 'get', 'https://horizon-testnet.stellar.org https://horizon-futurenet.stellar.org', ''
$BaseUri = $Uri

I looked at -QueryParameter, and -PathParameter, but didn't succeed at setting the url.
If it's possible, then a note how to direct requests to the desired server would be nice. And the issue title is incorrect.
Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions