Closed
Description
Describe the bug
When parameter is set with all section in a ref data file and filled with env variable, it's not resolved for PUT operation.
Example of ref data:
all:
id: $$NEW_ID
where NEW_ID was set to "1"
And path like /Brand/{id}
will result in .../Brand/1
for GET (which is expected),
but in .../Brand/$$NEW_ID
for PUT (which is not expected).
To Reproduce
- Reference data file "reference.yml" :
all:
id: $$NEW_ID
- Set $$NEW_ID as env variable, define its value
- Run
cats --contract=${CONTRACT_URL} --server=${SERVER_URL} --httpMethods=GET,PUT --refData="reference.yml"
setting
Expected behaviour
Env variable is replaced by it's value for PUT request.
Environment:
Key | Value |
---|---|
OS Name | Mac OS X |
OS Version | 14.6 |
OS Arch | amd64 |
Binary Type | native |
Cats Version | 13.1.0 |
Cats Build | 2025-01-17T06:37:06Z |
Term Width | 211 |
Term Type | xterm-256color |
Shell | /bin/zsh |
Example of OpenApi:
openapi: 3.0.0
info:
title: Brand API
version: "1.0.0"
paths:
/Brand/{id}:
get:
summary: Retrieve a brand by ID
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: A brand object
content:
application/json:
schema:
$ref: '#/components/schemas/Brand'
'404':
description: Brand not found
put:
summary: Update a brand by ID
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Brand'
responses:
'200':
description: Updated brand object
content:
application/json:
schema:
$ref: '#/components/schemas/Brand'
'400':
description: Invalid input
components:
schemas:
Brand:
type: object
properties:
id:
type: string
name:
type: string
required:
- id
- name