Skip to content

Define variables for the server URLΒ #94

@thetutlage

Description

@thetutlage

I have schema that uses the server property. Following is the snippet of the same.

  - url: http://localhost:{port}/{version}
    description: Local server
    variables:
      version:
        enum: ['v1']
        default: 'v1'
      port:
        default: '3333'

When validating the response against the schema, I want to pass the variables for port and version so that the validator can find the related paths defined in the schema.

Right now the validator fails with the error TypeError: Invalid URL.

TypeError: Invalid URL
    at new NodeError (node:internal/errors:388:5)
    at URL.onParseError (node:internal/url:564:9)
    at new URL (node:internal/url:644:5)
    at /node_modules/api-schema-builder/src/index.js:40:75
    at Array.map (<anonymous>)
    at buildValidations (/node_modules/api-schema-builder/src/index.js:40:32)
    at Object.buildSchemaSync (/node_modules/api-schema-builder/src/index.js:31:12)
    at /node_modules/api-contract-validator/lib/helpers/schema-utils.js:14:51
    at /node_modules/api-contract-validator/lib/helpers/schema-utils.js:22:44
    at Array.map (<anonymous>)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions