stoplightio / spectral

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.
https://stoplight.io/spectral
Apache License 2.0
2.37k stars 228 forks source link

oas3-server-variables detects ipv6 as invalid url #2554

Open mapero opened 7 months ago

mapero commented 7 months ago

Describe the bug When using ipv6 as default value of a server variable. spectral issues an error: error oas3-server-variables A few substitutions of server variables resulted in invalid URLs: https://%5Bfe80::dcad:beff:fe00:0001%5D/api/v1 servers[1].variables

To Reproduce

  1. Given this OpenAPI/AsyncAPI document '...'
servers:
  - url: '/api/v1'
  - url: 'https://{host}/api/v1'
    variables:
      host:
        default: '[fe80::dcad:beff:fe00:0001]'
        description: Hostname or ip address
  1. Run this CLI command '....' spectral lint api.yaml
  2. See error error oas3-server-variables A few substitutions of server variables resulted in invalid URLs: https://%5Bfe80::dcad:beff:fe00:0001%5D/api/v1 servers[1].variables

Expected behavior Accept the ip v6 address as valid variable

Screenshots

Environment (remove any that are not applicable):