Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 6.11 results in oas3-server-variables error for relative server URL and variable substitution #2545

Open
philipnbbc opened this issue Oct 13, 2023 · 1 comment

Comments

@philipnbbc
Copy link

philipnbbc commented Oct 13, 2023

Describe the bug
Docker image stoplight/spectral:6.11 is returning a oas3-server-variables error for a relative URL server that has a variable substitution.

To Reproduce
Given spec.yaml, an OpenAPI document (only servers: -url is important and the rest is to avoid errors/warnings):

openapi: 3.1.0
info:
  title: title
  description: description
  version: version
  contact:
    name: name
    email: email
servers:
  - url: /example/{version}
    variables:
      version:
        default: version
paths:
  /:
    get:
      description: description
      operationId: get
      tags:
        - tag
      responses:
        '200':
          description: description
tags:
  - name: tag
    description: description

and spectral.yaml config file,

extends: spectral:oas
rules: {}

Run docker run --rm -v $PWD:/data -w /data stoplight/spectral:6.11 lint spec.yaml and it returns:

/data/spec.yaml
 11:15  error  oas3-server-variables  A few substitutions of server variables resulted in invalid URLs: /example/version  servers[0].variables

Expected behavior
It should pass like it does for version 6.10 (No results with a severity of 'error' found!).

Note that it does pass for version 6.11 if the /{version} is removed from the url or if the url is an absolute URL.

Environment
Docker image stoplight/spectral version 6.11

Copy link
Contributor

github-actions bot commented May 3, 2024

This ticket has been labeled jira. A tracking ticket in Stoplight's Jira (STOP-504) has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants