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

Define variables for the server URL #94

Open
thetutlage opened this issue Aug 16, 2022 · 0 comments
Open

Define variables for the server URL #94

thetutlage opened this issue Aug 16, 2022 · 0 comments

Comments

@thetutlage
Copy link

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>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant